{
  "openapi": "3.1.0",
  "info": {
    "title": "StateSet EDI",
    "description": "X12 EDI platform for StateSet commerce: inbound 850/860/945/997 translation to VES events, outbound 855/856/810/940 generation, 997/TA1 acknowledgments, and trading partner management.\n\nAuthenticate with `Authorization: Bearer <token>` \u2014 either the admin token or a partner API key scoped to that partner's routes.",
    "contact": {
      "name": "Stateset Inc."
    },
    "license": {
      "name": "BUSL-1.1"
    },
    "version": "0.10.2"
  },
  "paths": {
    "/health": {
      "get": {
        "tags": [
          "system"
        ],
        "operationId": "health",
        "responses": {
          "200": {
            "description": "Service health and outbox depth"
          }
        }
      }
    },
    "/live": {
      "get": {
        "tags": [
          "system"
        ],
        "summary": "Liveness probe: is the process up and the async runtime responsive? This\ndeliberately does NOT probe the database. A liveness probe that fails on a\nDB outage makes the kubelet restart every replica, turning a recoverable\ndependency blip into a self-inflicted crash-loop. Readiness (`/health`)\nowns dependency health and load-balancer eviction; liveness only owns\n\"should this container be killed and recreated\".",
        "operationId": "live",
        "responses": {
          "200": {
            "description": "Process is alive"
          }
        }
      }
    },
    "/v1/adapters": {
      "get": {
        "tags": [
          "partners"
        ],
        "summary": "The packaged back-end integration catalog (ERP/WMS/TMS/e-commerce/carrier),\noptionally filtered by system class or the event type an adapter consumes.",
        "operationId": "list_adapters",
        "parameters": [
          {
            "name": "kind",
            "in": "query",
            "description": "System class filter",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "consumes",
            "in": "query",
            "description": "Canonical event type filter",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Back-end adapter catalog",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/AdapterDescriptor"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/adapters/connections": {
      "get": {
        "tags": [
          "partners"
        ],
        "summary": "Every live-adapter connection this workspace has configured (metadata\nonly), plus whether credential storage is enabled.",
        "operationId": "list_connections",
        "responses": {
          "200": {
            "description": "Workspace adapter connections; secrets are never returned",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/AdapterConnectionView"
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "bearer": []
          }
        ]
      }
    },
    "/v1/adapters/plan": {
      "post": {
        "tags": [
          "partners"
        ],
        "summary": "Plans the back-end actions a canonical event would trigger across every\ncatalogued adapter that consumes it \u2014 the routing preview for the event\nstream. Body is a VES event (`event_type`, `entity_type`, `entity_id`).",
        "operationId": "plan_adapters",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EdiEvent"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Planned back-end actions",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/AdapterAction"
                  }
                }
              }
            }
          },
          "422": {
            "description": "Unparseable event"
          }
        }
      }
    },
    "/v1/adapters/{name}/connection": {
      "get": {
        "tags": [
          "partners"
        ],
        "summary": "This workspace's connection metadata for one live adapter.",
        "operationId": "get_connection",
        "parameters": [
          {
            "name": "name",
            "in": "path",
            "description": "Live adapter name (shopify or netsuite)",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Connection metadata; secrets are never returned",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AdapterConnectionView"
                }
              }
            }
          },
          "404": {
            "description": "No connection configured"
          }
        },
        "security": [
          {
            "bearer": []
          }
        ]
      },
      "put": {
        "tags": [
          "partners"
        ],
        "summary": "Stores (or rotates) this workspace's credentials for a live adapter.\nShopify takes a `{shop}.myshopify.com` domain + Admin API token; NetSuite\ntakes the account id, an HTTPS `*.netsuite.com` RESTlet URL and\ntoken-based-authentication keys. Secrets are sealed at rest.",
        "operationId": "put_connection",
        "parameters": [
          {
            "name": "name",
            "in": "path",
            "description": "Live adapter name (shopify or netsuite)",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AdapterConnectionInput"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Connection saved; metadata only",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AdapterConnectionView"
                }
              }
            }
          },
          "403": {
            "description": "Organization administrator required"
          },
          "422": {
            "description": "Invalid input, non-HTTPS / non-vendor host, or storage not enabled"
          }
        },
        "security": [
          {
            "bearer": []
          }
        ]
      },
      "delete": {
        "tags": [
          "partners"
        ],
        "summary": "Removes this workspace's credentials for a live adapter.",
        "operationId": "delete_connection",
        "parameters": [
          {
            "name": "name",
            "in": "path",
            "description": "Live adapter name (shopify or netsuite)",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Connection removed"
          },
          "403": {
            "description": "Organization administrator required"
          },
          "404": {
            "description": "No connection configured"
          }
        },
        "security": [
          {
            "bearer": []
          }
        ]
      }
    },
    "/v1/adapters/{name}/connection/verify": {
      "post": {
        "tags": [
          "partners"
        ],
        "operationId": "verify_connection",
        "parameters": [
          {
            "name": "name",
            "in": "path",
            "description": "Shopify connection",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Read-only API access and granted-scope evidence, pinned to credential revision"
          },
          "409": {
            "description": "Credentials changed during verification"
          },
          "422": {
            "description": "No supported verification contract"
          }
        },
        "security": [
          {
            "bearer": []
          }
        ]
      }
    },
    "/v1/adapters/{name}/execute": {
      "post": {
        "tags": [
          "partners"
        ],
        "summary": "Delivers a canonical event through an explicitly selected live adapter.\nThis is never automatic: callers must choose the adapter and the action is\nattributed in the immutable operator audit ledger.",
        "description": "Credentials: a workspace executes with **its own** stored connection\n(`PUT /v1/adapters/{name}/connection`). The platform environment\ncredentials are used only by the platform admin token, and only when the\nselected workspace has no connection of its own.",
        "operationId": "execute_adapter",
        "parameters": [
          {
            "name": "name",
            "in": "path",
            "description": "Live adapter name (shopify or netsuite)",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EdiEvent"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Vendor accepted the event",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AdapterExecution"
                }
              }
            }
          },
          "403": {
            "description": "Partner credential, or an event stamped for another workspace"
          },
          "422": {
            "description": "Unsupported event, planning-only adapter, or no connection configured for this workspace"
          },
          "502": {
            "description": "Vendor API rejected or could not receive the event"
          }
        }
      }
    },
    "/v1/analytics": {
      "get": {
        "tags": [
          "operations"
        ],
        "summary": "Operational analytics: volume, error rate, throughput trend, and\ndocument activity spans by partner and transaction set.",
        "operationId": "analytics",
        "responses": {
          "200": {
            "description": "Analytics report",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AnalyticsReport"
                }
              }
            }
          },
          "403": {
            "description": "Admin credential required"
          }
        }
      }
    },
    "/v1/analytics/export": {
      "get": {
        "tags": [
          "operations"
        ],
        "summary": "Per-partner analytics as a CSV download.",
        "operationId": "analytics_export",
        "responses": {
          "200": {
            "description": "Per-partner analytics CSV",
            "content": {
              "text/csv": {}
            }
          },
          "403": {
            "description": "Admin credential required"
          }
        }
      }
    },
    "/v1/artifacts/conformance": {
      "get": {
        "tags": [
          "operations"
        ],
        "summary": "WS-1 acceptance evidence: for each packaged retail connector, instantiate the\npartner and generate the GS1 carton label, packing slip (PDF), commercial\ninvoice, and 856 from one canonical shipment, then validate each against the\npartner's spec. Returns a pass/fail conformance matrix.",
        "operationId": "artifacts_conformance",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "description": "Run only the first N connectors",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 0
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Per-connector artifact conformance matrix"
          }
        }
      }
    },
    "/v1/as1/inbound": {
      "post": {
        "tags": [
          "inbound"
        ],
        "summary": "Inbound AS1 (EDI-over-email) receive path: the mail service forwards a\nreceived email as JSON; we extract the EDI interchange and run it through\nthe standard inbound pipeline (parse \u2192 validate \u2192 acknowledge \u2192 translate \u2192\nsync). Bearer-authenticated \u2014 the mail service is a trusted first-party\ncaller carrying the platform token.",
        "operationId": "as1_inbound",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/As1InboundEmail"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Processing result with 997/TA1 acknowledgment",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InboundResult"
                }
              }
            }
          },
          "403": {
            "description": "Partner credential named a different partner_id"
          },
          "404": {
            "description": "No partner matches the ISA sender"
          },
          "409": {
            "description": "Duplicate interchange control number"
          },
          "422": {
            "description": "Email carries no EDI attachment/body, or unparseable"
          }
        }
      }
    },
    "/v1/as2": {
      "post": {
        "tags": [
          "inbound"
        ],
        "summary": "Inbound AS2: return a synchronous receipt, or durably queue an authenticated\nasynchronous receipt for the configured partner callback endpoint.",
        "description": "Unauthenticated by transport design \u2014 AS2 partners are identified by their\n`AS2-From`/`AS2-To` headers and their configured S/MIME security policy,\nrather than our bearer token. Per AS2 semantics the MDN is\nreturned with HTTP 200 even when the EDI is rejected; the *disposition*\ninside the MDN carries the accept/reject verdict. Only transport-level\nfailures produce a non-200.",
        "operationId": "as2_inbound",
        "requestBody": {
          "description": "AS2 message body (EDI payload)",
          "content": {
            "application/edi-x12": {
              "schema": {
                "type": "string"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Synchronous MDN or empty durable async receipt handoff"
          },
          "409": {
            "description": "Message-ID conflict or concurrent async admission"
          },
          "422": {
            "description": "Untrusted async sender or callback"
          },
          "503": {
            "description": "Receipt signing or durable persistence unavailable"
          }
        }
      }
    },
    "/v1/as2/identity": {
      "post": {
        "tags": [
          "operations"
        ],
        "summary": "Rotates the AS2 signing/decryption identity without a restart. The new\nkey + certificate are validated (parseable and currently valid) before the\natomic swap; in-flight requests finish with the identity they started\nwith. The cert-expiry monitor tracks the new certificate immediately.",
        "description": "With `EDI_AS2_PERSIST_IDENTITY=true` the rotation is written to the state\nbackend first (all-or-nothing) and every replica converges on it within a\nminute; without it the swap is this-replica-only and lost on restart \u2014\nthe response's `persisted` field says which happened.",
        "operationId": "rotate_as2_identity",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RotateAs2IdentityBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Identity rotated"
          },
          "403": {
            "description": "Platform-admin credential required"
          },
          "422": {
            "description": "Key/certificate invalid, expired or not yet valid"
          }
        }
      }
    },
    "/v1/as2/mdn": {
      "post": {
        "tags": [
          "operations"
        ],
        "summary": "Receives an **asynchronous MDN**: a partner POSTs the receipt for a message\nwe sent earlier (AS2 async mode). We match it to the tracked delivery by\n`Original-Message-ID`, verify the disposition and persisted sent MIC, then flip the delivery\nto `delivered` (or `failed` with the partner's reason). Unauthenticated by\nAS2 design; the match is to a Message-ID we minted, and a signed MDN must\nverify against the original transmission's pinned certificate before it can change\ndelivery state.",
        "operationId": "as2_mdn",
        "requestBody": {
          "description": "AS2 asynchronous MDN (optionally S/MIME signed)",
          "content": {
            "multipart/report": {
              "schema": {
                "type": "string"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "MDN processed (matched or ignored)"
          },
          "422": {
            "description": "Body is not a parseable MDN"
          }
        }
      }
    },
    "/v1/as2/receipts": {
      "get": {
        "tags": [
          "operations"
        ],
        "summary": "Tenant-scoped receipt callback delivery status.",
        "operationId": "list_as2_receipts",
        "responses": {
          "200": {
            "description": "Durable inbound async MDN callback metadata; archived receipt content is excluded and not verified",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/As2ReceiptListResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/as2/receipts/{id}/retry": {
      "post": {
        "tags": [
          "operations"
        ],
        "operationId": "retry_as2_receipt",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Receipt callback ID",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Retry original receipt bytes"
          },
          "404": {
            "description": "Receipt not found in tenant"
          },
          "409": {
            "description": "Callback has an active lease"
          }
        }
      }
    },
    "/v1/audit": {
      "get": {
        "tags": [
          "operations"
        ],
        "summary": "Immutable tenant-scoped operator actions, newest first.",
        "operationId": "audit_log",
        "parameters": [
          {
            "name": "actor",
            "in": "query",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "action",
            "in": "query",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "target",
            "in": "query",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "from",
            "in": "query",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ],
              "format": "date-time"
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ],
              "format": "date-time"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": [
                "integer",
                "null"
              ],
              "minimum": 0
            }
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "schema": {
              "type": [
                "integer",
                "null"
              ],
              "minimum": 0
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Paged operator audit records",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/AuditRecord"
                  }
                }
              }
            }
          },
          "403": {
            "description": "Admin or tenant credential required"
          }
        }
      }
    },
    "/v1/automation/auto-855": {
      "get": {
        "tags": [
          "orders"
        ],
        "operationId": "jobs",
        "responses": {
          "200": {
            "description": "Last 100 automatic business acknowledgment jobs; original PO payloads are omitted"
          }
        },
        "security": [
          {
            "bearer": []
          }
        ]
      }
    },
    "/v1/automation/auto-855/{job_id}/history": {
      "get": {
        "tags": [
          "orders"
        ],
        "operationId": "history",
        "parameters": [
          {
            "name": "job_id",
            "in": "path",
            "description": "Automatic 855 work identifier",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Metadata audit history survives terminal work retention"
          }
        },
        "security": [
          {
            "bearer": []
          }
        ]
      }
    },
    "/v1/automation/auto-855/{job_id}/retry": {
      "post": {
        "tags": [
          "orders"
        ],
        "operationId": "retry",
        "parameters": [
          {
            "name": "job_id",
            "in": "path",
            "description": "Held automatic 855 work identifier",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Reviewed retry keeps original PO/date and rebinds to current qualified partner policy"
          }
        },
        "security": [
          {
            "bearer": []
          }
        ]
      }
    },
    "/v1/business-reconciliation": {
      "get": {
        "tags": [
          "operations"
        ],
        "summary": "Business-level reconciliation across PO / ASN / 945 / invoice / payment.",
        "operationId": "business_reconciliation",
        "responses": {
          "200": {
            "description": "Order-chain match status per reference"
          }
        }
      }
    },
    "/v1/callback-deliveries": {
      "get": {
        "tags": [
          "operations"
        ],
        "operationId": "deliveries",
        "responses": {
          "200": {
            "description": "Latest 200 deliveries without payload or secrets"
          }
        },
        "security": [
          {
            "bearer": []
          }
        ]
      }
    },
    "/v1/callback-deliveries/{id}/history": {
      "get": {
        "tags": [
          "operations"
        ],
        "operationId": "history",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Delivery",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Frozen payload and latest 100 attempts and reviews"
          }
        },
        "security": [
          {
            "bearer": []
          }
        ]
      }
    },
    "/v1/callback-deliveries/{id}/retry": {
      "post": {
        "tags": [
          "operations"
        ],
        "operationId": "retry",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Held delivery",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CallbackRetry"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Reviewed retry preserves original event ID, bytes and signing revision"
          }
        },
        "security": [
          {
            "bearer": []
          }
        ]
      }
    },
    "/v1/callbacks": {
      "get": {
        "tags": [
          "operations"
        ],
        "operationId": "list",
        "responses": {
          "200": {
            "description": "Subscriptions and revisions without signing secrets"
          }
        },
        "security": [
          {
            "bearer": []
          }
        ]
      }
    },
    "/v1/callbacks/{id}": {
      "put": {
        "tags": [
          "operations"
        ],
        "operationId": "save",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Subscription name",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CallbackInput"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "New immutable endpoint/key revision"
          },
          "409": {
            "description": "Version changed"
          }
        },
        "security": [
          {
            "bearer": []
          }
        ]
      }
    },
    "/v1/callbacks/{id}/revisions/{version}/revoke": {
      "post": {
        "tags": [
          "operations"
        ],
        "operationId": "revoke",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Subscription",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "version",
            "in": "path",
            "description": "Signing revision",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Revision permanently revoked; queued deliveries will hold"
          }
        },
        "security": [
          {
            "bearer": []
          }
        ]
      }
    },
    "/v1/callbacks/{id}/state": {
      "put": {
        "tags": [
          "operations"
        ],
        "operationId": "set_state",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Subscription",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CallbackState"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Enable or pause subscription; existing claims may already be in flight"
          }
        },
        "security": [
          {
            "bearer": []
          }
        ]
      }
    },
    "/v1/capabilities": {
      "get": {
        "tags": [
          "system"
        ],
        "operationId": "capabilities",
        "responses": {
          "200": {
            "description": "Implementation support and evidence boundaries"
          }
        }
      }
    },
    "/v1/catalog": {
      "get": {
        "tags": [
          "operations"
        ],
        "summary": "The item master (assortment) for the tenant, optionally by partner.",
        "operationId": "list_catalog",
        "parameters": [
          {
            "name": "partner_id",
            "in": "query",
            "description": "Filter to one partner",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Item-master records",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/CatalogItemRecord"
                  }
                }
              }
            }
          },
          "403": {
            "description": "Admin credential required"
          }
        }
      }
    },
    "/v1/catalog/ingest/{partner_id}": {
      "post": {
        "tags": [
          "operations"
        ],
        "summary": "Ingests an 832 price/sales catalog into the partner's item master, bumping a\nper-item version only where attributes changed. Returns a created/updated/\nunchanged summary.",
        "operationId": "ingest_catalog",
        "parameters": [
          {
            "name": "partner_id",
            "in": "path",
            "description": "Partner ID",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Catalog832"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Ingest summary",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IngestSummary"
                }
              }
            }
          },
          "403": {
            "description": "Not this credential's partner"
          }
        }
      }
    },
    "/v1/commercial-invoice/{partner_id}": {
      "post": {
        "tags": [
          "outbound"
        ],
        "summary": "Generates a commercial invoice / customs document from a canonical\ncommercial-invoice payload. Emits a signed `edi.commercial_invoice.generated`\nVES event. The response flags whether every line carries the HS code and\ncountry of origin a compliant declaration needs.",
        "operationId": "commercial_invoice",
        "parameters": [
          {
            "name": "partner_id",
            "in": "path",
            "description": "Partner ID",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CommercialInvoice"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Commercial invoice (structured + HTML)"
          },
          "403": {
            "description": "Not this credential's partner"
          },
          "422": {
            "description": "Invalid payload"
          }
        }
      }
    },
    "/v1/connections/ftps": {
      "get": {
        "tags": [
          "connections"
        ],
        "operationId": "ftps_list",
        "responses": {
          "200": {
            "description": "Tenant-owned FTPS mailboxes, without credentials"
          }
        }
      }
    },
    "/v1/connections/ftps/deliveries": {
      "get": {
        "tags": [
          "connections"
        ],
        "operationId": "ftps_deliveries",
        "responses": {
          "200": {
            "description": "Last 100 outbound mailbox uploads; delivery does not establish counterparty acceptance"
          }
        },
        "security": [
          {
            "bearer": []
          }
        ]
      }
    },
    "/v1/connections/ftps/{connection_id}/retire": {
      "post": {
        "tags": [
          "connections"
        ],
        "operationId": "ftps_retire",
        "parameters": [
          {
            "name": "connection_id",
            "in": "path",
            "description": "Connection revision",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "New routing and pickup stopped; pending work retains original revision"
          }
        },
        "security": [
          {
            "bearer": []
          }
        ]
      }
    },
    "/v1/connections/ftps/{connection_id}/state": {
      "patch": {
        "tags": [
          "connections"
        ],
        "operationId": "ftps_state",
        "parameters": [
          {
            "name": "connection_id",
            "in": "path",
            "description": "Mailbox revision identifier",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/FtpsMailboxState"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Pickup and queued uploads paused or resumed"
          }
        },
        "security": [
          {
            "bearer": []
          }
        ]
      }
    },
    "/v1/connections/ftps/{partner_id}": {
      "post": {
        "tags": [
          "connections"
        ],
        "operationId": "ftps_save",
        "parameters": [
          {
            "name": "partner_id",
            "in": "path",
            "description": "Trading partner identifier",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/FtpsMailboxInput"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Tested mailbox saved; production pickup remains gated by partner readiness"
          }
        }
      }
    },
    "/v1/connections/mail": {
      "get": {
        "tags": [
          "connections"
        ],
        "operationId": "list",
        "responses": {
          "200": {
            "description": "Encrypted Mail connections without credentials; availability is configuration, not transport qualification",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MailConnectionsResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearer": []
          }
        ]
      },
      "post": {
        "tags": [
          "connections"
        ],
        "operationId": "save",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MailConnectionInput"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Verified sender and immutable connection saved; no email sent",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MailConnectionResponse"
                }
              }
            }
          },
          "403": {
            "description": "Organization administrator or explicit mail:configure scope required"
          }
        },
        "security": [
          {
            "bearer": []
          }
        ]
      }
    },
    "/v1/connections/mail/managed": {
      "post": {
        "tags": [
          "connections"
        ],
        "operationId": "managed",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ManagedMailInput"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Managed tenant, mailbox and scoped connection ready; replay returns the original connection",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MailConnectionResponse"
                }
              }
            }
          },
          "409": {
            "description": "Setup is already running or provider configuration changed"
          }
        },
        "security": [
          {
            "bearer": []
          }
        ]
      }
    },
    "/v1/connections/mail/provisioning": {
      "get": {
        "tags": [
          "connections"
        ],
        "operationId": "provisioning",
        "responses": {
          "200": {
            "description": "Resumable setup operations in this workspace; no provider credentials",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MailProvisioningResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearer": []
          }
        ]
      }
    },
    "/v1/connections/mail/{connection_id}/state": {
      "patch": {
        "tags": [
          "connections"
        ],
        "operationId": "set_state",
        "parameters": [
          {
            "name": "connection_id",
            "in": "path",
            "description": "Original connection revision",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MailConnectionState"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Submission paused or resumed"
          },
          "409": {
            "description": "Submission in progress; pause has not taken effect"
          }
        },
        "security": [
          {
            "bearer": []
          }
        ]
      }
    },
    "/v1/connections/sftp": {
      "get": {
        "tags": [
          "connections"
        ],
        "operationId": "sftp_list",
        "responses": {
          "200": {
            "description": "Tenant-owned SFTP mailboxes, without credentials"
          }
        }
      }
    },
    "/v1/connections/sftp/deliveries": {
      "get": {
        "tags": [
          "connections"
        ],
        "operationId": "sftp_deliveries",
        "responses": {
          "200": {
            "description": "Last 100 outbound mailbox uploads; delivery does not establish counterparty acceptance"
          }
        },
        "security": [
          {
            "bearer": []
          }
        ]
      }
    },
    "/v1/connections/sftp/{connection_id}/retire": {
      "post": {
        "tags": [
          "connections"
        ],
        "operationId": "sftp_retire",
        "parameters": [
          {
            "name": "connection_id",
            "in": "path",
            "description": "Connection revision",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "New routing and pickup stopped; pending work retains original revision"
          }
        },
        "security": [
          {
            "bearer": []
          }
        ]
      }
    },
    "/v1/connections/sftp/{connection_id}/state": {
      "patch": {
        "tags": [
          "connections"
        ],
        "operationId": "sftp_state",
        "parameters": [
          {
            "name": "connection_id",
            "in": "path",
            "description": "Mailbox revision identifier",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MailboxState"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Pickup and queued uploads paused or resumed"
          }
        },
        "security": [
          {
            "bearer": []
          }
        ]
      }
    },
    "/v1/connections/sftp/{partner_id}": {
      "post": {
        "tags": [
          "connections"
        ],
        "operationId": "sftp_save",
        "parameters": [
          {
            "name": "partner_id",
            "in": "path",
            "description": "Trading partner identifier",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MailboxInput"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Tested mailbox saved; production pickup remains gated by partner readiness"
          }
        }
      }
    },
    "/v1/connections/sync": {
      "get": {
        "tags": [
          "connections"
        ],
        "operationId": "list",
        "responses": {
          "200": {
            "description": "Workspace Sync connections; no credentials returned"
          }
        },
        "security": [
          {
            "bearer": []
          }
        ]
      },
      "post": {
        "tags": [
          "connections"
        ],
        "operationId": "save",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ConnectionInput"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Credentials tested and immutable connection revision saved"
          },
          "400": {
            "description": "Connection test rejected"
          },
          "403": {
            "description": "Organization administrator required"
          }
        },
        "security": [
          {
            "bearer": []
          }
        ]
      }
    },
    "/v1/connections/sync/deliveries": {
      "get": {
        "tags": [
          "connections"
        ],
        "operationId": "deliveries",
        "responses": {
          "200": {
            "description": "Latest 100 tenant-scoped Sync delivery receipts; Sync acceptance does not establish ERP acceptance"
          }
        },
        "security": [
          {
            "bearer": []
          }
        ]
      }
    },
    "/v1/connections/sync/deliveries/{event_id}/outcome": {
      "get": {
        "tags": [
          "connections"
        ],
        "operationId": "outcome",
        "parameters": [
          {
            "name": "event_id",
            "in": "path",
            "description": "Accepted EDI event identifier",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Original Sync order observation; not proof that this EDI change completed in an ERP",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SyncOutcomeResponse"
                }
              }
            }
          },
          "404": {
            "description": "No delivery in this workspace"
          }
        },
        "security": [
          {
            "bearer": []
          }
        ]
      }
    },
    "/v1/connector-sdk/certify": {
      "post": {
        "tags": [
          "partners"
        ],
        "summary": "Certify a connector manifest: validate it, then instantiate a sample partner\nand run the artifact conformance suite. With `?publish=true`, a passing\nconnector is published to the shared template library (the reuse flywheel),\nwhere any tenant can inherit it \u2014 the SDK's self-publish path.",
        "operationId": "certify_connector_manifest",
        "parameters": [
          {
            "name": "publish",
            "in": "query",
            "description": "Publish to the template library on pass",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ConnectorManifest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Validation + conformance verdict, and the published template when requested"
          }
        }
      }
    },
    "/v1/connector-sdk/validate": {
      "post": {
        "tags": [
          "partners"
        ],
        "summary": "Validate a connector manifest (SDK) without persisting \u2014 structure, a\nsupported X12 version, and that every declared transaction set is supported.",
        "operationId": "validate_connector_manifest",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ConnectorManifest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Manifest validation issues"
          }
        }
      }
    },
    "/v1/connectors": {
      "get": {
        "tags": [
          "partners"
        ],
        "summary": "Lists the built-in retailer connectors, optionally filtered by vertical.",
        "operationId": "list_connectors",
        "parameters": [
          {
            "name": "category",
            "in": "query",
            "description": "Retail vertical, e.g. beauty",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Available retailer connectors",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Connector"
                  }
                }
              }
            }
          },
          "403": {
            "description": "Admin credential required"
          }
        }
      }
    },
    "/v1/connectors/{name}": {
      "get": {
        "tags": [
          "partners"
        ],
        "summary": "Returns one retailer connector, including its starter validation guide.",
        "operationId": "get_connector",
        "parameters": [
          {
            "name": "name",
            "in": "path",
            "description": "Connector name, e.g. walmart",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Connector profile",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Connector"
                }
              }
            }
          },
          "403": {
            "description": "Admin credential required"
          },
          "404": {
            "description": "Unknown connector"
          }
        }
      }
    },
    "/v1/connectors/{name}/partners/{id}": {
      "post": {
        "tags": [
          "partners"
        ],
        "summary": "Creates (or updates) a trading partner from a retailer connector, filling\nin the retailer's qualifiers, version, delimiters, and starter guide; the\nbody supplies the relationship-specific identifiers.",
        "operationId": "create_partner_from_connector",
        "parameters": [
          {
            "name": "name",
            "in": "path",
            "description": "Connector name, e.g. walmart",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "id",
            "in": "path",
            "description": "Internal partner ID to create",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ConnectorPartnerParams"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "The created partner (key hash redacted)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TradingPartner"
                }
              }
            }
          },
          "403": {
            "description": "Admin credential required"
          },
          "404": {
            "description": "Unknown connector"
          }
        }
      }
    },
    "/v1/customs/postal/{partner_id}": {
      "post": {
        "tags": [
          "outbound"
        ],
        "summary": "Generates a CN22/CN23 postal customs declaration from a commercial-invoice\npayload (the form is chosen by goods value). Emits a signed\n`edi.postal_declaration.generated` event.",
        "operationId": "postal_declaration",
        "parameters": [
          {
            "name": "partner_id",
            "in": "path",
            "description": "Partner ID",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CommercialInvoice"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Postal declaration (structured + HTML)"
          },
          "403": {
            "description": "Not this credential's partner"
          },
          "422": {
            "description": "Invalid payload"
          }
        }
      }
    },
    "/v1/deadletter": {
      "get": {
        "tags": [
          "operations"
        ],
        "summary": "Events the sequencer permanently rejected and that were moved out of the\nactive queue after exhausting delivery attempts.",
        "operationId": "deadletter",
        "responses": {
          "200": {
            "description": "Dead-lettered events with rejection reasons"
          },
          "403": {
            "description": "Admin credential required"
          }
        }
      }
    },
    "/v1/deadletter/replay": {
      "post": {
        "tags": [
          "operations"
        ],
        "summary": "Replays every dead-lettered event back into the active outbox so the next\nflush re-attempts delivery to the sequencer. Safe to call repeatedly: the\nsequencer dedups by event ID.",
        "operationId": "replay_deadletter",
        "responses": {
          "200": {
            "description": "Dead-lettered events returned to the queue"
          },
          "403": {
            "description": "Admin credential required"
          }
        }
      }
    },
    "/v1/deadletter/{event_id}/discard": {
      "post": {
        "tags": [
          "operations"
        ],
        "summary": "Permanently discards one dead-lettered event \u2014 the deliberate way to give\nup on an event Sync will never accept. Releases the order lane it held, so\nthe events queued behind it are delivered without it; recorded in the\noperator audit log with the event and its rejection reason.",
        "operationId": "discard_deadletter",
        "parameters": [
          {
            "name": "event_id",
            "in": "path",
            "description": "Dead-lettered event ID",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The discarded dead letter"
          },
          "403": {
            "description": "Admin credential required"
          },
          "404": {
            "description": "No such dead letter in scope"
          },
          "409": {
            "description": "Replayed or discarded concurrently"
          }
        }
      }
    },
    "/v1/deductions": {
      "get": {
        "tags": [
          "operations"
        ],
        "summary": "Lists deductions for the tenant with an exposure/recovery summary.",
        "operationId": "list_deductions",
        "responses": {
          "200": {
            "description": "Deductions + summary",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Deduction"
                  }
                }
              }
            }
          },
          "403": {
            "description": "Admin credential required"
          }
        }
      },
      "post": {
        "tags": [
          "operations"
        ],
        "summary": "Captures a deduction (from an inbound 812 or keyed by an operator). The ID is\nderived from the partner + adjustment number so re-capturing the same\nchargeback updates rather than duplicates.",
        "operationId": "capture_deduction",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DeductionCapture"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Captured deduction",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Deduction"
                }
              }
            }
          },
          "403": {
            "description": "Admin credential required"
          }
        }
      }
    },
    "/v1/deductions/{id}": {
      "get": {
        "tags": [
          "operations"
        ],
        "summary": "One deduction with its dispute history.",
        "operationId": "get_deduction",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Deduction ID",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Deduction",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Deduction"
                }
              }
            }
          },
          "404": {
            "description": "Unknown deduction"
          }
        }
      }
    },
    "/v1/deductions/{id}/categorize": {
      "post": {
        "tags": [
          "operations"
        ],
        "summary": "Assigns a root-cause category to a deduction.",
        "operationId": "categorize_deduction",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Deduction ID",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Updated deduction",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Deduction"
                }
              }
            }
          }
        }
      }
    },
    "/v1/deductions/{id}/dispute": {
      "post": {
        "tags": [
          "operations"
        ],
        "summary": "Opens a dispute on a deduction.",
        "operationId": "dispute_deduction",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Deduction ID",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Updated deduction",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Deduction"
                }
              }
            }
          },
          "422": {
            "description": "Already resolved"
          }
        }
      }
    },
    "/v1/deductions/{id}/evidence": {
      "post": {
        "tags": [
          "operations"
        ],
        "summary": "Attaches supporting evidence (a note + optional link) to a deduction \u2014 the\nchain of custody a dispute is won on.",
        "operationId": "add_deduction_evidence",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Deduction ID",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Updated deduction",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Deduction"
                }
              }
            }
          }
        }
      }
    },
    "/v1/deductions/{id}/resolve": {
      "post": {
        "tags": [
          "operations"
        ],
        "summary": "Resolves a deduction to a terminal outcome (recovered / denied / written off).",
        "operationId": "resolve_deduction",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Deduction ID",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Resolved deduction",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Deduction"
                }
              }
            }
          },
          "422": {
            "description": "Invalid outcome or recovery amount"
          }
        }
      }
    },
    "/v1/deliveries": {
      "get": {
        "tags": [
          "operations"
        ],
        "summary": "Outbound AS2 deliveries and their status (pending / delivered / failed),\nscoped to the caller's tenant. Payloads are redacted.",
        "operationId": "list_deliveries",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "description": "Page size (default 500, clamped to 1..1000)",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 0
            }
          },
          {
            "name": "offset",
            "in": "query",
            "description": "Deliveries to skip, newest first with ID tie-breaker (default 0)",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 0
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Tracked AS2 deliveries with retry status",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PagedDeliveries"
                }
              }
            }
          },
          "403": {
            "description": "Admin credential required"
          }
        }
      }
    },
    "/v1/deliveries/mail": {
      "get": {
        "tags": [
          "operations"
        ],
        "summary": "Tenant-scoped Mail submission receipts. Request bodies and bindings are omitted.",
        "operationId": "list_mail_deliveries",
        "responses": {
          "200": {
            "description": "Email submission attempts and Mail receipts; not recipient acceptance",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MailDeliveryResponse"
                }
              }
            }
          },
          "403": {
            "description": "Workspace credential required"
          }
        }
      }
    },
    "/v1/deliveries/redeliver-bulk": {
      "post": {
        "tags": [
          "operations"
        ],
        "summary": "Bulk re-drives every **failed** delivery (optionally for one partner) back to\npending so the worker retries them \u2014 e.g. after a partner endpoint recovers.\nIdempotent at the AS2 layer; capped at 500.",
        "operationId": "redeliver_bulk",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RedeliverBulkBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Bulk redeliver summary"
          },
          "403": {
            "description": "Admin credential required"
          }
        }
      }
    },
    "/v1/deliveries/{id}/evidence": {
      "get": {
        "tags": [
          "operations"
        ],
        "summary": "Export a tenant-scoped AS2 transmission and its authenticated receipt.\nPublic verification certificates and original wire bytes are included;\nprivate signing keys and current connection settings are never included.",
        "operationId": "delivery_evidence",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Delivery ID",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Original AS2 transmission and receipt evidence"
          },
          "403": {
            "description": "Tenant administrative credential required"
          },
          "404": {
            "description": "Delivery not found in this tenant"
          }
        }
      }
    },
    "/v1/deliveries/{id}/redeliver": {
      "post": {
        "tags": [
          "operations"
        ],
        "summary": "Re-drives a failed (or stuck) AS2 delivery: resets it to pending and due now\nso the delivery worker re-attempts it. Idempotent at the AS2 layer \u2014 a\nmessage the partner already accepted won't double-apply.",
        "operationId": "redeliver",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Delivery ID",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Delivery re-queued for the worker"
          },
          "403": {
            "description": "Admin credential required"
          },
          "404": {
            "description": "Unknown delivery"
          }
        }
      }
    },
    "/v1/documents": {
      "get": {
        "tags": [
          "operations"
        ],
        "summary": "Paged: `data` stays a plain array (newest first) and `page` carries\n`{total, limit, offset}` so existing consumers keep working while new ones\ncan walk the full log.",
        "operationId": "documents",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "description": "Page size (default 200, max 1000)",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 0
            }
          },
          {
            "name": "offset",
            "in": "query",
            "description": "Documents to skip, newest first (default 0)",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 0
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Recent processed documents, newest first",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PagedDocuments"
                }
              }
            }
          },
          "403": {
            "description": "Admin credential required"
          }
        }
      }
    },
    "/v1/documents/manual": {
      "post": {
        "tags": [
          "operations"
        ],
        "summary": "Manual document entry for partners without back-end integration: an operator\npastes a raw inbound interchange and the gateway processes it through the\nnormal pipeline (validation \u2192 translation \u2192 acknowledgment), recording it as\noperator-entered. Idempotent like any inbound; a duplicate control number is\nrejected.",
        "operationId": "manual_document_entry",
        "requestBody": {
          "description": "Raw X12/EDIFACT interchange keyed by an operator",
          "content": {
            "application/edi-x12": {
              "schema": {
                "type": "string"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Processing result with acknowledgment",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InboundResult"
                }
              }
            }
          },
          "403": {
            "description": "Admin credential required"
          },
          "409": {
            "description": "Duplicate interchange control number"
          }
        }
      }
    },
    "/v1/documents/reprocess-bulk": {
      "post": {
        "tags": [
          "operations"
        ],
        "summary": "Bulk-reprocesses stored **inbound** documents matching a filter \u2014 e.g.\nre-drive every rejected 850 for a partner after a guide fix. Idempotent like\nsingle reprocess; capped at 500 documents per call.",
        "operationId": "reprocess_bulk",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReprocessBulkBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Bulk reprocess summary"
          },
          "403": {
            "description": "Admin credential required"
          }
        }
      }
    },
    "/v1/documents/{id}": {
      "get": {
        "tags": [
          "operations"
        ],
        "operationId": "document_detail",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Document audit ID",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Document drill-down detail",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentDetail"
                }
              }
            }
          },
          "403": {
            "description": "Admin credential required"
          },
          "404": {
            "description": "Unknown document"
          }
        }
      }
    },
    "/v1/documents/{id}/evidence": {
      "get": {
        "tags": [
          "operations"
        ],
        "summary": "Compliance evidence bundle for one document and its related order chain.",
        "operationId": "document_evidence",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Document ID",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Evidence bundle for the document and its order chain"
          },
          "404": {
            "description": "Unknown document"
          }
        }
      }
    },
    "/v1/documents/{id}/reprocess": {
      "post": {
        "tags": [
          "operations"
        ],
        "summary": "Reprocesses a stored **inbound** document: re-runs validation, translation,\nand acknowledgment against the partner's current implementation guide. The\ndeterministic dedup event ID means re-deriving events from the same wire\ncollapses in the outbox \u2014 no duplicate orders.",
        "operationId": "reprocess_document",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Document audit ID",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Reprocessing result with fresh acknowledgment"
          },
          "403": {
            "description": "Admin credential required"
          },
          "404": {
            "description": "Unknown document"
          },
          "422": {
            "description": "Document is outbound (use re-deliver) or unparseable"
          }
        }
      }
    },
    "/v1/edi/inbound": {
      "post": {
        "tags": [
          "inbound"
        ],
        "operationId": "inbound",
        "requestBody": {
          "description": "Raw X12 interchange",
          "content": {
            "application/edi-x12": {
              "schema": {
                "type": "string"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Processing result with 997 (or TA1) acknowledgment",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InboundResult"
                }
              }
            }
          },
          "404": {
            "description": "No partner matches the ISA sender"
          },
          "409": {
            "description": "Duplicate interchange control number"
          },
          "422": {
            "description": "Unparseable X12"
          }
        }
      }
    },
    "/v1/edi/inbound/{partner_id}": {
      "post": {
        "tags": [
          "inbound"
        ],
        "operationId": "inbound_for",
        "parameters": [
          {
            "name": "partner_id",
            "in": "path",
            "description": "Partner ID",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "description": "Raw X12 interchange",
          "content": {
            "application/edi-x12": {
              "schema": {
                "type": "string"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Processing result with 997 (or TA1) acknowledgment",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InboundResult"
                }
              }
            }
          },
          "403": {
            "description": "Not this credential's partner"
          },
          "409": {
            "description": "Duplicate interchange control number"
          }
        }
      }
    },
    "/v1/edi/outbound/204/{partner_id}": {
      "post": {
        "tags": [
          "outbound"
        ],
        "operationId": "outbound_204",
        "parameters": [
          {
            "name": "partner_id",
            "in": "path",
            "description": "Partner ID",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "description": "Stable unique request key (1\u2013128 ASCII letters/digits or -_.:). Requires Postgres. Retries return the original EDI bytes; changed JSON payload returns 409.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Tender204"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Wire-ready X12 204 load tender",
            "content": {
              "application/edi-x12": {}
            }
          },
          "403": {
            "description": "Not this credential's partner"
          },
          "409": {
            "description": "Idempotency-Key reused with a different payload"
          },
          "422": {
            "description": "Invalid payload or delimiter collision"
          }
        }
      }
    },
    "/v1/edi/outbound/270/{partner_id}": {
      "post": {
        "tags": [
          "outbound"
        ],
        "operationId": "outbound_270",
        "parameters": [
          {
            "name": "partner_id",
            "in": "path",
            "description": "Partner ID",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "description": "Stable unique request key (1\u2013128 ASCII letters/digits or -_.:). Requires Postgres. Retries return the original EDI bytes; changed JSON payload returns 409.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EligibilityInquiry270"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Wire-ready X12 270 eligibility inquiry",
            "content": {
              "application/edi-x12": {}
            }
          },
          "403": {
            "description": "Not this credential's partner"
          },
          "409": {
            "description": "Idempotency-Key reused with a different payload"
          },
          "422": {
            "description": "Invalid payload or delimiter collision"
          }
        }
      }
    },
    "/v1/edi/outbound/753/{partner_id}": {
      "post": {
        "tags": [
          "outbound"
        ],
        "operationId": "outbound_753",
        "parameters": [
          {
            "name": "partner_id",
            "in": "path",
            "description": "Partner ID",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "description": "Stable unique request key (1\u2013128 ASCII letters/digits or -_.:). Requires Postgres. Retries return the original EDI bytes; changed JSON payload returns 409.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RoutingRequest753"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Wire-ready X12 753 routing request",
            "content": {
              "application/edi-x12": {}
            }
          },
          "403": {
            "description": "Not this credential's partner"
          },
          "409": {
            "description": "Idempotency-Key reused with a different payload"
          },
          "422": {
            "description": "Invalid payload or delimiter collision"
          }
        }
      }
    },
    "/v1/edi/outbound/810/{partner_id}": {
      "post": {
        "tags": [
          "outbound"
        ],
        "operationId": "outbound_810",
        "parameters": [
          {
            "name": "partner_id",
            "in": "path",
            "description": "Partner ID",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "description": "Stable unique request key (1\u2013128 ASCII letters/digits or -_.:). Requires Postgres. Retries return the original EDI bytes; changed JSON payload returns 409.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Invoice810"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Wire-ready X12 810 interchange",
            "content": {
              "application/edi-x12": {}
            }
          },
          "403": {
            "description": "Not this credential's partner"
          },
          "409": {
            "description": "Idempotency-Key reused with a different payload"
          },
          "422": {
            "description": "Invalid payload or delimiter collision, or blocked by the partner's outbound compliance policy (issues in error.issues). Sent documents carry X-EDI-Compliance-Warnings with the pre-send issue count"
          }
        }
      }
    },
    "/v1/edi/outbound/832/{partner_id}": {
      "post": {
        "tags": [
          "outbound"
        ],
        "summary": "Publishes an outbound 832 price/sales catalog to a partner.",
        "operationId": "outbound_832",
        "parameters": [
          {
            "name": "partner_id",
            "in": "path",
            "description": "Partner ID",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "description": "Stable unique request key (1\u2013128 ASCII letters/digits or -_.:). Requires Postgres. Retries return the original EDI bytes; changed JSON payload returns 409.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Catalog832"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Wire-ready X12 832 interchange",
            "content": {
              "application/edi-x12": {}
            }
          },
          "403": {
            "description": "Not this credential's partner"
          },
          "409": {
            "description": "Idempotency-Key reused with a different payload"
          },
          "422": {
            "description": "Invalid payload"
          }
        }
      }
    },
    "/v1/edi/outbound/846/{partner_id}": {
      "post": {
        "tags": [
          "outbound"
        ],
        "operationId": "outbound_846",
        "parameters": [
          {
            "name": "partner_id",
            "in": "path",
            "description": "Partner ID",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "description": "Stable unique request key (1\u2013128 ASCII letters/digits or -_.:). Requires Postgres. Retries return the original EDI bytes; changed JSON payload returns 409.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/InventoryAdvice846"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Wire-ready X12 846 interchange",
            "content": {
              "application/edi-x12": {}
            }
          },
          "403": {
            "description": "Not this credential's partner"
          },
          "409": {
            "description": "Idempotency-Key reused with a different payload"
          },
          "422": {
            "description": "Invalid payload or delimiter collision"
          }
        }
      }
    },
    "/v1/edi/outbound/855/{partner_id}": {
      "post": {
        "tags": [
          "outbound"
        ],
        "operationId": "outbound_855",
        "parameters": [
          {
            "name": "partner_id",
            "in": "path",
            "description": "Partner ID",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "description": "Stable unique request key (1\u2013128 ASCII letters/digits or -_.:). Requires Postgres. Retries return the original EDI bytes; changed JSON payload returns 409.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Ack855"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Wire-ready X12 855 interchange",
            "content": {
              "application/edi-x12": {}
            }
          },
          "403": {
            "description": "Not this credential's partner"
          },
          "409": {
            "description": "Idempotency-Key reused with a different payload"
          },
          "422": {
            "description": "Invalid payload or delimiter collision, or blocked by the partner's outbound compliance policy (issues in error.issues). Sent documents carry X-EDI-Compliance-Warnings with the pre-send issue count"
          }
        }
      }
    },
    "/v1/edi/outbound/856/{partner_id}": {
      "post": {
        "tags": [
          "outbound"
        ],
        "operationId": "outbound_856",
        "parameters": [
          {
            "name": "partner_id",
            "in": "path",
            "description": "Partner ID",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "description": "Stable unique request key (1\u2013128 ASCII letters/digits or -_.:). Requires Postgres. Retries return the original EDI bytes; changed JSON payload returns 409.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Asn856"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Wire-ready X12 856 interchange",
            "content": {
              "application/edi-x12": {}
            }
          },
          "403": {
            "description": "Not this credential's partner"
          },
          "409": {
            "description": "Idempotency-Key reused with a different payload"
          },
          "422": {
            "description": "Invalid payload or delimiter collision, or blocked by the partner's outbound compliance policy (issues in error.issues). Sent documents carry X-EDI-Compliance-Warnings with the pre-send issue count"
          }
        }
      }
    },
    "/v1/edi/outbound/865/{partner_id}": {
      "post": {
        "tags": [
          "outbound"
        ],
        "operationId": "outbound_865",
        "parameters": [
          {
            "name": "partner_id",
            "in": "path",
            "description": "Partner ID",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "description": "Stable unique request key (1\u2013128 ASCII letters/digits or -_.:). Requires Postgres. Retries return the original EDI bytes; changed JSON payload returns 409.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Ack865"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Wire-ready X12 865 interchange",
            "content": {
              "application/edi-x12": {}
            }
          },
          "403": {
            "description": "Not this credential's partner"
          },
          "409": {
            "description": "Idempotency-Key reused with a different payload"
          },
          "422": {
            "description": "Invalid payload or delimiter collision"
          }
        }
      }
    },
    "/v1/edi/outbound/940/{partner_id}": {
      "post": {
        "tags": [
          "outbound"
        ],
        "operationId": "outbound_940",
        "parameters": [
          {
            "name": "partner_id",
            "in": "path",
            "description": "Partner ID",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "description": "Stable unique request key (1\u2013128 ASCII letters/digits or -_.:). Requires Postgres. Retries return the original EDI bytes; changed JSON payload returns 409.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Ship940"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Wire-ready X12 940 interchange",
            "content": {
              "application/edi-x12": {}
            }
          },
          "403": {
            "description": "Not this credential's partner"
          },
          "409": {
            "description": "Idempotency-Key reused with a different payload"
          },
          "422": {
            "description": "Invalid payload or delimiter collision"
          }
        }
      }
    },
    "/v1/edi/outbound/943/{partner_id}": {
      "post": {
        "tags": [
          "outbound"
        ],
        "operationId": "outbound_943",
        "parameters": [
          {
            "name": "partner_id",
            "in": "path",
            "description": "Partner ID",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "description": "Stable unique request key (1\u2013128 ASCII letters/digits or -_.:). Requires Postgres. Retries return the original EDI bytes; changed JSON payload returns 409.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Transfer943"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Wire-ready X12 943 interchange",
            "content": {
              "application/edi-x12": {}
            }
          },
          "403": {
            "description": "Not this credential's partner"
          },
          "409": {
            "description": "Idempotency-Key reused with a different payload"
          },
          "422": {
            "description": "Invalid payload or delimiter collision"
          }
        }
      }
    },
    "/v1/edi/outbound/{set}/{partner_id}/check": {
      "post": {
        "tags": [
          "outbound"
        ],
        "summary": "Runs the outbound pre-send compliance check against the stored PO(s) and\nthe partner's outbound rules without sending anything. Evaluates\nregardless of the partner's `outbound_compliance` mode, and reports what\nthat mode would do.",
        "operationId": "check_outbound",
        "parameters": [
          {
            "name": "set",
            "in": "path",
            "description": "855, 856 or 810",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "partner_id",
            "in": "path",
            "description": "Partner ID",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "description": "The same body POST /v1/edi/outbound/{set}/{partner_id} accepts (Ack855, Asn856 or Invoice810)",
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Compliance issues, with `passed` and `would_block`"
          },
          "403": {
            "description": "Not this credential's partner"
          },
          "422": {
            "description": "Invalid payload or unsupported set"
          }
        }
      }
    },
    "/v1/edi/parse": {
      "post": {
        "tags": [
          "operations"
        ],
        "summary": "Parses arbitrary X12 and returns the envelope structure \u2014 a debugging aid.",
        "operationId": "parse_document",
        "requestBody": {
          "description": "Raw X12 interchange",
          "content": {
            "application/edi-x12": {
              "schema": {
                "type": "string"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Parsed envelope structure"
          },
          "422": {
            "description": "Unparseable or invalid X12"
          }
        }
      }
    },
    "/v1/edi/validate": {
      "post": {
        "tags": [
          "inbound"
        ],
        "summary": "Dry-run validation against the ISA- or UNB-resolved partner's guide.",
        "operationId": "validate_document",
        "requestBody": {
          "description": "Raw X12 or EDIFACT interchange; detected from ISA, UNB, or UNA",
          "content": {
            "application/edi-x12": {
              "schema": {
                "type": "string"
              }
            },
            "application/edifact": {
              "schema": {
                "type": "string"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Validation report (no side effects)"
          },
          "404": {
            "description": "No partner matches the ISA or UNB sender"
          },
          "422": {
            "description": "Unparseable or misaddressed interchange"
          }
        }
      }
    },
    "/v1/edi/validate/{partner_id}": {
      "post": {
        "tags": [
          "inbound"
        ],
        "summary": "Dry-run validation against a specific partner's implementation guide.",
        "operationId": "validate_document_for",
        "parameters": [
          {
            "name": "partner_id",
            "in": "path",
            "description": "Partner ID",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "description": "Raw X12 or EDIFACT interchange; detected from ISA, UNB, or UNA",
          "content": {
            "application/edi-x12": {
              "schema": {
                "type": "string"
              }
            },
            "application/edifact": {
              "schema": {
                "type": "string"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Validation report (no side effects)"
          },
          "403": {
            "description": "Not this credential's partner"
          }
        }
      }
    },
    "/v1/edifact/outbound/desadv/{partner_id}": {
      "post": {
        "tags": [
          "outbound"
        ],
        "operationId": "edifact_outbound_desadv",
        "parameters": [
          {
            "name": "partner_id",
            "in": "path",
            "description": "Partner ID",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "description": "Stable unique request key (1\u2013128 ASCII letters/digits or -_.:). Requires Postgres. Retries return the original EDI bytes; changed JSON payload returns 409.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EdifactDespatchAdvice"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Wire-ready UN/EDIFACT DESADV interchange",
            "content": {
              "application/EDIFACT": {}
            }
          },
          "403": {
            "description": "Not this credential's partner"
          },
          "409": {
            "description": "Idempotency-Key reused with a different payload"
          },
          "422": {
            "description": "Invalid payload"
          }
        }
      }
    },
    "/v1/edifact/outbound/invoic/{partner_id}": {
      "post": {
        "tags": [
          "outbound"
        ],
        "operationId": "edifact_outbound_invoic",
        "parameters": [
          {
            "name": "partner_id",
            "in": "path",
            "description": "Partner ID",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "description": "Stable unique request key (1\u2013128 ASCII letters/digits or -_.:). Requires Postgres. Retries return the original EDI bytes; changed JSON payload returns 409.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EdifactInvoice"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Wire-ready UN/EDIFACT INVOIC interchange",
            "content": {
              "application/EDIFACT": {}
            }
          },
          "403": {
            "description": "Not this credential's partner"
          },
          "409": {
            "description": "Idempotency-Key reused with a different payload"
          },
          "422": {
            "description": "Invalid payload"
          }
        }
      }
    },
    "/v1/edifact/outbound/invrpt/{partner_id}": {
      "post": {
        "tags": [
          "outbound"
        ],
        "operationId": "edifact_outbound_invrpt",
        "parameters": [
          {
            "name": "partner_id",
            "in": "path",
            "description": "Partner ID",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "description": "Stable unique request key (1\u2013128 ASCII letters/digits or -_.:). Requires Postgres. Retries return the original EDI bytes; changed JSON payload returns 409.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EdifactInventoryReport"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Wire-ready UN/EDIFACT INVRPT interchange",
            "content": {
              "application/EDIFACT": {}
            }
          },
          "403": {
            "description": "Not this credential's partner"
          },
          "409": {
            "description": "Idempotency-Key reused with a different payload"
          },
          "422": {
            "description": "Invalid payload"
          }
        }
      }
    },
    "/v1/einvoice/ubl/{partner_id}": {
      "post": {
        "tags": [
          "outbound"
        ],
        "summary": "Generates a Peppol BIS Billing 3.0 UBL e-invoice from a canonical invoice\npayload. Emits a signed `edi.einvoice.generated` VES event. The response\nreports BIS completeness and the delivery status \u2014 generation is performed\nhere; transmission to a government / Peppol network requires a certified\naccess-point partner (the `delivery` seam), per the deliberate A- scope.",
        "operationId": "einvoice_ubl",
        "parameters": [
          {
            "name": "partner_id",
            "in": "path",
            "description": "Partner ID",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UblInvoiceInput"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "UBL e-invoice (XML + validation + delivery status)"
          },
          "403": {
            "description": "Not this credential's partner"
          },
          "422": {
            "description": "Invalid payload"
          }
        }
      }
    },
    "/v1/einvoice/ubl/{partner_id}/validate": {
      "post": {
        "tags": [
          "outbound"
        ],
        "summary": "Validates a Peppol-BIS invoice payload against the BIS Billing 3.0 business\nrules (EN 16931 + PEPPOL) without generating or persisting \u2014 the conformance\ngate before handing UBL to an access point.",
        "operationId": "einvoice_ubl_validate",
        "parameters": [
          {
            "name": "partner_id",
            "in": "path",
            "description": "Partner ID",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UblInvoiceInput"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "BIS validation result (valid + per-rule issues)"
          }
        }
      }
    },
    "/v1/erp/events": {
      "post": {
        "tags": [
          "outbound"
        ],
        "summary": "Accepts a typed ERP/Sync event and sends the matching order document from\nthe stored PO: `order.acknowledged` \u2192 855, `fulfillment.created` \u2192 856,\n`invoice.created` \u2192 810, with `data` as the overrides. Idempotent per\ntenant on `event_id`; each processed event is recorded in the audit log.",
        "operationId": "erp_event",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ErpEvent"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Document sent (or the original returned for a retried event_id)"
          },
          "403": {
            "description": "Not this credential's partner"
          },
          "404": {
            "description": "Unknown partner, or no accepted 850 for this PO"
          },
          "409": {
            "description": "Order or partner policy changed, PO cancelled, nothing remaining, or event_id reused with a different payload"
          },
          "422": {
            "description": "Invalid event, required retail-v1 source facts missing, or blocked by outbound compliance"
          }
        }
      }
    },
    "/v1/evidence/{reference}": {
      "get": {
        "tags": [
          "operations"
        ],
        "summary": "Compliance evidence bundle for a PO / shipment / invoice reference.",
        "operationId": "reference_evidence",
        "parameters": [
          {
            "name": "reference",
            "in": "path",
            "description": "PO / shipment / invoice reference",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "partner_id",
            "in": "query",
            "description": "Select the partner explicitly when a reference occurs in multiple relationships.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Evidence bundle for every document carrying the reference"
          }
        }
      }
    },
    "/v1/fulfillment": {
      "get": {
        "tags": [
          "operations"
        ],
        "summary": "3PL / fulfillment scorecard: fill rate, perfect-order rate, and at-risk\norders (chargeback exposure) aggregated across all reconciled orders.",
        "operationId": "fulfillment_scorecard",
        "responses": {
          "200": {
            "description": "Fulfillment scorecard",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FulfillmentScorecard"
                }
              }
            }
          },
          "403": {
            "description": "Admin credential required"
          }
        }
      }
    },
    "/v1/hosted-sftp/files": {
      "get": {
        "tags": [
          "connections"
        ],
        "operationId": "files",
        "responses": {
          "200": {
            "description": "Last 100 mailbox files, processing results and download observations; no raw bytes"
          }
        },
        "security": [
          {
            "bearer": []
          }
        ]
      }
    },
    "/v1/hosted-sftp/files/{file_id}": {
      "delete": {
        "tags": [
          "connections"
        ],
        "operationId": "purge",
        "parameters": [
          {
            "name": "file_id",
            "in": "path",
            "description": "Resource identifier",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Terminal file purged with a durable audit record; pending and linked source data are protected"
          }
        },
        "security": [
          {
            "bearer": []
          }
        ]
      }
    },
    "/v1/hosted-sftp/files/{file_id}/retry": {
      "post": {
        "tags": [
          "connections"
        ],
        "operationId": "retry",
        "parameters": [
          {
            "name": "file_id",
            "in": "path",
            "description": "Resource identifier",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Held processing retried with the original bytes; original acceptance is replayed"
          }
        },
        "security": [
          {
            "bearer": []
          }
        ]
      }
    },
    "/v1/hosted-sftp/mailboxes": {
      "get": {
        "tags": [
          "connections"
        ],
        "operationId": "list",
        "responses": {
          "200": {
            "description": "Native hosted mailboxes and active listener; public metadata only"
          }
        },
        "security": [
          {
            "bearer": []
          }
        ]
      }
    },
    "/v1/hosted-sftp/mailboxes/{mailbox_id}/revoke-key": {
      "post": {
        "tags": [
          "connections"
        ],
        "operationId": "revoke_key",
        "parameters": [
          {
            "name": "mailbox_id",
            "in": "path",
            "description": "Resource identifier",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/KeyRevocation"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Key revoked in live sessions; revoking the last key disables the mailbox"
          }
        },
        "security": [
          {
            "bearer": []
          }
        ]
      }
    },
    "/v1/hosted-sftp/mailboxes/{mailbox_id}/state": {
      "patch": {
        "tags": [
          "connections"
        ],
        "operationId": "set_state",
        "parameters": [
          {
            "name": "mailbox_id",
            "in": "path",
            "description": "Resource identifier",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/HostedSftpMailboxState"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Access suspended or resumed, including authenticated sessions"
          }
        },
        "security": [
          {
            "bearer": []
          }
        ]
      }
    },
    "/v1/hosted-sftp/mailboxes/{partner_id}": {
      "post": {
        "tags": [
          "connections"
        ],
        "operationId": "provision",
        "parameters": [
          {
            "name": "partner_id",
            "in": "path",
            "description": "Resource identifier",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/HostedSftpMailboxInput"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Mailbox created or key/quota policy replaced; username remains stable"
          }
        },
        "security": [
          {
            "bearer": []
          }
        ]
      }
    },
    "/v1/labels/856/{partner_id}": {
      "post": {
        "tags": [
          "outbound"
        ],
        "summary": "Generates a UCC-128 shipping label (SSCC-18 + ZPL) from an 856 ASN body.\nRequires `EDI_GS1_COMPANY_PREFIX`. One label per shipment.",
        "operationId": "label_856",
        "parameters": [
          {
            "name": "partner_id",
            "in": "path",
            "description": "Partner ID",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Asn856"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "SSCC + ZPL shipping label"
          },
          "403": {
            "description": "Not this credential's partner"
          },
          "422": {
            "description": "GS1 company prefix not configured, or invalid ASN"
          }
        }
      }
    },
    "/v1/labels/856/{partner_id}/cartons": {
      "post": {
        "tags": [
          "outbound"
        ],
        "summary": "Generates one UCC-128 GS1-128 label per carton from an 856 ASN's carton\nbreakdown, each with its own SSCC-18 and a \"CARTON i OF n\" mark. Emits a\nsigned `edi.carton_labels.generated` event. Returns 422 if the ASN has no\ncarton breakdown (use `/v1/labels/856/{id}` for a shipment-level label).",
        "operationId": "carton_labels_856",
        "parameters": [
          {
            "name": "partner_id",
            "in": "path",
            "description": "Partner ID",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Asn856"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Per-carton SSCC labels"
          },
          "403": {
            "description": "Not this credential's partner"
          },
          "422": {
            "description": "ASN has no carton breakdown"
          }
        }
      }
    },
    "/v1/labels/856/{partner_id}/level/{level}": {
      "post": {
        "tags": [
          "outbound"
        ],
        "summary": "Generates GS1 labels at a specific pack **level** \u2014 `carton` (SSCC, AI 00),\n`inner` (a case of one trade item: GTIN AI 02 + count AI 37), or `each` (a\nsingle unit: GTIN AI 01) \u2014 applying the partner's [`LabelProfile`] placement\n(size, darkness, required mark). Pallet labels come from the carton endpoint\nwith `?pallet_sscc=`.",
        "operationId": "labels_for_level",
        "parameters": [
          {
            "name": "partner_id",
            "in": "path",
            "description": "Partner ID",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "level",
            "in": "path",
            "description": "Pack level: carton | inner | each",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Asn856"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Labels for the requested pack level"
          },
          "403": {
            "description": "Not this credential's partner"
          },
          "422": {
            "description": "Unknown level or invalid ASN"
          }
        }
      }
    },
    "/v1/leads": {
      "get": {
        "tags": [
          "operations"
        ],
        "summary": "Lists recent captured leads (operator view). Leads come from the public\nmarketing funnel and carry no tenant attribution, so this is a platform\nsurface: only the global admin token may read them \u2014 a tenant or partner\nkey must not see other prospects' contact details.",
        "operationId": "list_leads",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "description": "Max leads to return (default 100)",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 0
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Recent leads, newest first"
          },
          "403": {
            "description": "Not the platform admin"
          }
        }
      },
      "post": {
        "tags": [
          "operations"
        ],
        "summary": "Captures an inbound sales lead from the public checker / landing page.\nPublic: no bearer token. The lead is stored durably and, when a CRM webhook\nis configured (`EDI_LEAD_WEBHOOK_URL`), forwarded best-effort in the\nbackground so a slow CRM never delays the response.",
        "operationId": "capture_lead",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/NewLead"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Lead captured"
          },
          "422": {
            "description": "Invalid submission (e.g. missing/invalid email)"
          }
        }
      }
    },
    "/v1/lifecycle/{reference}": {
      "get": {
        "tags": [
          "operations"
        ],
        "summary": "Order lifecycle trace for one PO / shipment / invoice reference.",
        "operationId": "lifecycle_trace",
        "parameters": [
          {
            "name": "reference",
            "in": "path",
            "description": "PO / shipment / invoice reference",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "partner_id",
            "in": "query",
            "description": "Select the partner explicitly when a reference occurs in multiple relationships.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Lifecycle events for the reference, oldest first"
          }
        }
      }
    },
    "/v1/mappings/preview": {
      "post": {
        "tags": [
          "partners"
        ],
        "operationId": "preview",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MappingPreview"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Deterministic mapped output; no publication or delivery"
          }
        },
        "security": [
          {
            "bearer": []
          }
        ]
      }
    },
    "/v1/mappings/{partner_id}/{name}": {
      "get": {
        "tags": [
          "partners"
        ],
        "operationId": "versions",
        "parameters": [
          {
            "name": "partner_id",
            "in": "path",
            "description": "Partner",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "name",
            "in": "path",
            "description": "Mapping name",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Latest 100 immutable revisions, newest first"
          }
        },
        "security": [
          {
            "bearer": []
          }
        ]
      },
      "post": {
        "tags": [
          "partners"
        ],
        "operationId": "publish",
        "parameters": [
          {
            "name": "partner_id",
            "in": "path",
            "description": "Partner",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "name",
            "in": "path",
            "description": "Mapping name",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MappingPublish"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Immutable revision published after regression fixtures pass"
          },
          "409": {
            "description": "Head changed since review"
          }
        },
        "security": [
          {
            "bearer": []
          }
        ]
      }
    },
    "/v1/mappings/{partner_id}/{name}/{version}/transform": {
      "post": {
        "tags": [
          "partners"
        ],
        "operationId": "transform",
        "parameters": [
          {
            "name": "partner_id",
            "in": "path",
            "description": "Partner",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "name",
            "in": "path",
            "description": "Mapping name",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "version",
            "in": "path",
            "description": "Immutable version",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Transform against an explicitly pinned mapping revision"
          }
        },
        "security": [
          {
            "bearer": []
          }
        ]
      }
    },
    "/v1/monitoring": {
      "get": {
        "tags": [
          "operations"
        ],
        "summary": "Real-time monitoring snapshot: per-partner acknowledgment SLA status,\ndead-letter and failed-delivery counts, and active alerts.",
        "operationId": "monitoring",
        "responses": {
          "200": {
            "description": "Monitoring snapshot",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MonitoringSnapshot"
                }
              }
            }
          },
          "403": {
            "description": "Admin credential required"
          }
        }
      }
    },
    "/v1/monitoring/evaluate": {
      "post": {
        "tags": [
          "operations"
        ],
        "summary": "Evaluates monitoring and **fires** every critical alert through the\nconfigured alerter (webhook/email) \u2014 the push hook a scheduler calls.\nReturns the snapshot and how many alerts were dispatched.",
        "operationId": "monitoring_evaluate",
        "responses": {
          "200": {
            "description": "Snapshot + count of alerts fired"
          },
          "403": {
            "description": "Admin credential required"
          }
        }
      }
    },
    "/v1/network/readiness": {
      "get": {
        "tags": [
          "operations"
        ],
        "summary": "Trading-network readiness across partners in the selected tenant.",
        "operationId": "network_readiness",
        "responses": {
          "200": {
            "description": "Per-partner go-live readiness summary"
          }
        }
      }
    },
    "/v1/onboarding": {
      "get": {
        "tags": [
          "partners"
        ],
        "summary": "All onboarding records for the tenant, newest activity first.",
        "operationId": "list_onboarding",
        "responses": {
          "200": {
            "description": "Onboarding records",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/OnboardingRecord"
                  }
                }
              }
            }
          },
          "403": {
            "description": "Admin credential required"
          }
        }
      }
    },
    "/v1/operations/exceptions": {
      "get": {
        "tags": [
          "operations"
        ],
        "operationId": "exceptions",
        "parameters": [
          {
            "name": "partner_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "owner",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Active source failures and case ownership; no payloads or credentials"
          }
        },
        "security": [
          {
            "bearer": []
          }
        ]
      }
    },
    "/v1/operations/exceptions/{kind}/{id}": {
      "get": {
        "tags": [
          "operations"
        ],
        "operationId": "case_snapshot",
        "parameters": [
          {
            "name": "kind",
            "in": "path",
            "description": "Exact source kind",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "id",
            "in": "path",
            "description": "Exact source identifier",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Current tenant-scoped source and case snapshot, including inactive sources"
          },
          "404": {
            "description": "Source not found in caller's tenant"
          }
        },
        "security": [
          {
            "bearer": []
          }
        ]
      },
      "patch": {
        "tags": [
          "operations"
        ],
        "operationId": "update_case",
        "parameters": [
          {
            "name": "kind",
            "in": "path",
            "description": "Scoped identifier",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "id",
            "in": "path",
            "description": "Scoped identifier",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CaseUpdate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Audited case update"
          },
          "409": {
            "description": "Revision changed or source failure remains active"
          }
        },
        "security": [
          {
            "bearer": []
          }
        ]
      }
    },
    "/v1/operations/exceptions/{kind}/{id}/history": {
      "get": {
        "tags": [
          "operations"
        ],
        "operationId": "history",
        "parameters": [
          {
            "name": "kind",
            "in": "path",
            "description": "Scoped identifier",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "id",
            "in": "path",
            "description": "Scoped identifier",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Last 100 case changes, newest first"
          }
        },
        "security": [
          {
            "bearer": []
          }
        ]
      }
    },
    "/v1/operations/orders": {
      "get": {
        "tags": [
          "operations"
        ],
        "operationId": "orders",
        "parameters": [
          {
            "name": "partner_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Latest 200 distinct accepted orders, explicitly scoped by partner"
          }
        },
        "security": [
          {
            "bearer": []
          }
        ]
      }
    },
    "/v1/operations/orders/{partner_id}/{po_number}": {
      "get": {
        "tags": [
          "operations"
        ],
        "operationId": "order",
        "parameters": [
          {
            "name": "partner_id",
            "in": "path",
            "description": "Scoped identifier",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "po_number",
            "in": "path",
            "description": "Scoped identifier",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Order state and independently labelled document, transport, acknowledgment and downstream evidence"
          }
        },
        "security": [
          {
            "bearer": []
          }
        ]
      }
    },
    "/v1/operations/orders/{partner_id}/{po_number}/preview/{set}": {
      "post": {
        "tags": [
          "orders"
        ],
        "operationId": "preview_order_document",
        "parameters": [
          {
            "name": "partner_id",
            "in": "path",
            "description": "Partner",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "po_number",
            "in": "path",
            "description": "Purchase order",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "set",
            "in": "path",
            "description": "855, 856 or 810",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Prepared document and compliance issues; sends nothing"
          }
        },
        "security": [
          {
            "bearer": []
          }
        ]
      }
    },
    "/v1/orders/{po_number}/drafts/{set}": {
      "get": {
        "tags": [
          "outbound"
        ],
        "summary": "Returns a pre-filled 855/856/810 request body built from the stored 850\n(with later 860 changes applied) \u2014 exactly the shape\n`POST /v1/edi/outbound/{set}/{partner_id}` accepts \u2014 plus an `order`\nsummary of ordered / shipped / invoiced quantities per line.",
        "operationId": "order_draft",
        "parameters": [
          {
            "name": "po_number",
            "in": "path",
            "description": "Buyer PO number (BEG03)",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "set",
            "in": "path",
            "description": "855, 856 or 810; or desadv / invoic for the EDIFACT body of the 856 / 810 draft",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "partner_id",
            "in": "query",
            "description": "The trading partner that sent the PO. Optional for a partner-scoped\ncredential (defaults to its own partner).",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "`data` is the ready-to-send request body; `order` summarizes the PO"
          },
          "403": {
            "description": "Not this credential's partner"
          },
          "404": {
            "description": "Unknown partner, or no accepted 850 for this PO"
          },
          "409": {
            "description": "PO cancelled (856/810) or nothing left to ship / invoice"
          },
          "422": {
            "description": "Unsupported set"
          }
        }
      }
    },
    "/v1/orders/{po_number}/{set}/{partner_id}": {
      "post": {
        "tags": [
          "outbound"
        ],
        "summary": "Builds the draft for `set` from the stored PO, merges the small overrides\nbody onto it, runs the partner's compliance gate, and dispatches it through\nthe standard outbound path. Responds like `POST /v1/edi/outbound/{set}`.",
        "operationId": "send_order_document",
        "parameters": [
          {
            "name": "po_number",
            "in": "path",
            "description": "Buyer PO number (BEG03)",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "set",
            "in": "path",
            "description": "855, 856 or 810",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "partner_id",
            "in": "path",
            "description": "Partner ID",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "description": "Stable unique request key (1\u2013128 ASCII letters/digits or -_.:). Requires Postgres. Retries return the original EDI bytes; a changed overrides body returns 409.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "If-Order-Revision",
            "in": "header",
            "description": "Revision returned by order preview; requires Idempotency-Key. Atomic acceptance rejects stale order or partner configuration.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          }
        ],
        "requestBody": {
          "description": "Overrides for the set: Ack855Overrides, Asn856Overrides or Invoice810Overrides. An empty body sends the draft as-is.",
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Wire-ready X12 interchange; X-EDI-Compliance-Warnings carries the issue count",
            "content": {
              "application/edi-x12": {}
            }
          },
          "403": {
            "description": "Not this credential's partner"
          },
          "404": {
            "description": "Unknown partner, or no accepted 850 for this PO"
          },
          "409": {
            "description": "PO cancelled, nothing remaining, or Idempotency-Key reused with a different body"
          },
          "422": {
            "description": "Invalid overrides, or blocked by outbound compliance (issues in error.issues)"
          }
        }
      }
    },
    "/v1/outbox": {
      "get": {
        "tags": [
          "operations"
        ],
        "operationId": "outbox",
        "responses": {
          "200": {
            "description": "Pending VES events",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/EdiEvent"
                  }
                }
              }
            }
          },
          "403": {
            "description": "Admin credential required"
          }
        }
      }
    },
    "/v1/outbox/flush": {
      "post": {
        "tags": [
          "operations"
        ],
        "operationId": "outbox_flush",
        "responses": {
          "200": {
            "description": "Events pushed to the StateSet sequencer"
          },
          "403": {
            "description": "Admin credential required"
          },
          "502": {
            "description": "Sequencer unreachable"
          }
        }
      }
    },
    "/v1/packing-slip/856/{partner_id}": {
      "post": {
        "tags": [
          "outbound"
        ],
        "summary": "Generates a packing slip (printable HTML + ZPL summary label) from an 856\nASN body, bound to the shipment \u2192 order \u2192 pack \u2192 item hierarchy. Emits a\nsigned `edi.packing_slip.generated` VES event so the artifact is\nreproducible and auditable.",
        "operationId": "packing_slip_856",
        "parameters": [
          {
            "name": "partner_id",
            "in": "path",
            "description": "Partner ID",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Asn856"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Packing slip (structured + HTML + ZPL)"
          },
          "403": {
            "description": "Not this credential's partner"
          },
          "422": {
            "description": "Invalid ASN payload"
          }
        }
      }
    },
    "/v1/packing-slip/856/{partner_id}/pdf": {
      "post": {
        "tags": [
          "outbound"
        ],
        "summary": "Same canonical 856 \u2192 ASN as [`packing_slip_856`], but streams the **native\nPDF** bytes (`application/pdf`) for direct printing/download.",
        "operationId": "packing_slip_856_pdf",
        "parameters": [
          {
            "name": "partner_id",
            "in": "path",
            "description": "Partner ID",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Asn856"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Packing slip as a native PDF",
            "content": {
              "application/pdf": {}
            }
          },
          "403": {
            "description": "Not this credential's partner"
          },
          "422": {
            "description": "Invalid ASN payload"
          }
        }
      }
    },
    "/v1/partners": {
      "get": {
        "tags": [
          "partners"
        ],
        "operationId": "list_partners",
        "responses": {
          "200": {
            "description": "All trading partners (key hashes redacted)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/TradingPartner"
                  }
                }
              }
            }
          },
          "403": {
            "description": "Admin credential required"
          }
        }
      }
    },
    "/v1/partners/{id}": {
      "get": {
        "tags": [
          "partners"
        ],
        "operationId": "get_partner",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Partner ID",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Partner record, key hash redacted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TradingPartner"
                }
              }
            }
          },
          "403": {
            "description": "Not this credential's partner"
          },
          "404": {
            "description": "Unknown partner"
          }
        }
      },
      "put": {
        "tags": [
          "partners"
        ],
        "operationId": "upsert_partner",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Partner ID",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TradingPartner"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Stored partner (credentials are never set this way)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TradingPartner"
                }
              }
            }
          },
          "403": {
            "description": "Admin credential required"
          },
          "422": {
            "description": "Invalid identity, version, or count/outbound guide rules"
          }
        }
      }
    },
    "/v1/partners/{id}/api-key": {
      "post": {
        "tags": [
          "partners"
        ],
        "summary": "Issues (or rotates) a partner API key. The plaintext is returned exactly\nonce; only its SHA-256 is stored.",
        "operationId": "issue_partner_key",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Partner ID",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "New API key \u2014 shown exactly once; replaces any previous key"
          },
          "403": {
            "description": "Admin credential required"
          },
          "404": {
            "description": "Unknown partner"
          }
        }
      }
    },
    "/v1/partners/{id}/certification/run": {
      "post": {
        "tags": [
          "partners"
        ],
        "summary": "Runs a certification test pack against a partner: every sample interchange\nis validated (side-effect-free) against the partner's implementation guide\nand checked against its expected outcome. Emits an audit event; a custom\npack never grants production readiness or publishes customer configuration.",
        "operationId": "run_certification",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Partner ID",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TestPack"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Diagnostic report and onboarding/template disposition",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CertificationResponse"
                }
              }
            }
          },
          "403": {
            "description": "Not this credential's partner"
          },
          "404": {
            "description": "Unknown partner"
          },
          "422": {
            "description": "Invalid test pack"
          }
        }
      }
    },
    "/v1/partners/{id}/certification/run-standard": {
      "post": {
        "tags": [
          "partners"
        ],
        "summary": "Runs the prebuilt retail-baseline certification pack \u2014 generated for this\npartner's envelope \u2014 so a customer can certify without authoring samples.",
        "operationId": "run_standard_certification",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Partner ID",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Internal validation report and onboarding/template disposition",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CertificationResponse"
                }
              }
            }
          },
          "403": {
            "description": "Not this credential's partner"
          },
          "404": {
            "description": "Unknown partner"
          },
          "422": {
            "description": "Invalid partner guide or qualification pack"
          }
        }
      }
    },
    "/v1/partners/{id}/guide": {
      "get": {
        "tags": [
          "partners"
        ],
        "operationId": "get_partner_guide",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Tenant-owned partner",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Saved guide and opaque edit revision",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GuideResponse_GuideDraft"
                }
              }
            }
          },
          "404": {
            "description": "Unknown partner"
          }
        }
      },
      "put": {
        "tags": [
          "partners"
        ],
        "operationId": "publish_partner_guide",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Tenant-owned partner",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/GuideUpdate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Guide, immutable snapshot and audit committed together",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GuideResponse_GuidePublication"
                }
              }
            }
          },
          "404": {
            "description": "Unknown partner"
          },
          "409": {
            "description": "Guide or partner settings changed; reload before publishing"
          },
          "422": {
            "description": "Invalid guide or durable guide publishing unavailable"
          }
        }
      }
    },
    "/v1/partners/{id}/guide/diff": {
      "get": {
        "tags": [
          "partners"
        ],
        "summary": "Field-level diff between two guide versions.",
        "operationId": "diff_guide",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Partner ID",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "from",
            "in": "query",
            "description": "Base version",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32",
              "minimum": 0
            }
          },
          {
            "name": "to",
            "in": "query",
            "description": "Target version",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32",
              "minimum": 0
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Guide diff",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GuideDiff"
                }
              }
            }
          },
          "404": {
            "description": "Unknown version"
          }
        }
      }
    },
    "/v1/partners/{id}/guide/rollback/{version}": {
      "post": {
        "tags": [
          "partners"
        ],
        "summary": "Rolls a partner's guide back to an earlier version: restores that version's\nvalidation + overlay onto the partner and records the restore as a new\nversion (history is append-only, never rewritten).",
        "operationId": "rollback_guide",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Partner ID",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "version",
            "in": "path",
            "description": "Version to restore",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32",
              "minimum": 0
            }
          }
        ],
        "requestBody": {
          "description": "Optional saved revision; PostgreSQL restores the guide, snapshot and audit atomically",
          "content": {
            "application/json": {
              "schema": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/GuideRollback"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "New version recording the rollback",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GuideSnapshot"
                }
              }
            }
          },
          "404": {
            "description": "Unknown partner or version"
          },
          "409": {
            "description": "The guide or partner settings changed"
          }
        }
      }
    },
    "/v1/partners/{id}/guide/snapshot": {
      "post": {
        "tags": [
          "partners"
        ],
        "summary": "Captures the partner's current implementation guide (validation + overlay) as\nthe next immutable version.",
        "operationId": "snapshot_guide",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Partner ID",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The captured guide version",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GuideSnapshot"
                }
              }
            }
          },
          "404": {
            "description": "Unknown partner"
          }
        }
      }
    },
    "/v1/partners/{id}/guide/validate": {
      "post": {
        "tags": [
          "partners"
        ],
        "summary": "Validates a partner's current guide (validation rules + overlay) without\npublishing \u2014 the editor's pre-flight check. Returns errors and warnings.",
        "operationId": "validate_guide",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Partner ID",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "description": "Optional unsaved validation rules and overlay; omit to validate the saved guide",
          "content": {
            "application/json": {
              "schema": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/GuideContent"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Guide validation report",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GuideResponse_GuideValidationReport"
                }
              }
            }
          }
        }
      }
    },
    "/v1/partners/{id}/guide/versions": {
      "get": {
        "tags": [
          "partners"
        ],
        "summary": "Lists a partner's guide versions (oldest first).",
        "operationId": "list_guide_versions",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Partner ID",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Guide versions",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/GuideSnapshot"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/partners/{id}/network-mailbox": {
      "get": {
        "tags": [
          "partners"
        ],
        "summary": "stateset-mail managed mailbox readiness for a partner transport mailbox.",
        "operationId": "network_mailbox",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Partner ID",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Managed AS1 mailbox readiness for the partner"
          },
          "404": {
            "description": "Unknown partner"
          }
        }
      }
    },
    "/v1/partners/{id}/onboarding": {
      "get": {
        "tags": [
          "partners"
        ],
        "summary": "One partner's onboarding record.",
        "operationId": "get_onboarding",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Partner ID",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Onboarding record",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OnboardingRecord"
                }
              }
            }
          },
          "404": {
            "description": "Onboarding not started"
          }
        }
      }
    },
    "/v1/partners/{id}/onboarding/blocker": {
      "post": {
        "tags": [
          "partners"
        ],
        "summary": "Sets or clears the blocker on a partner's onboarding.",
        "operationId": "set_onboarding_blocker",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Partner ID",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Updated onboarding record",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OnboardingRecord"
                }
              }
            }
          },
          "404": {
            "description": "Onboarding not started"
          }
        }
      }
    },
    "/v1/partners/{id}/onboarding/start": {
      "post": {
        "tags": [
          "partners"
        ],
        "summary": "Starts onboarding for a partner at the `connected` stage (idempotent).",
        "operationId": "start_onboarding",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Partner ID",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Onboarding record",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OnboardingRecord"
                }
              }
            }
          },
          "404": {
            "description": "Unknown partner"
          }
        }
      }
    },
    "/v1/partners/{id}/onboarding/transition": {
      "post": {
        "tags": [
          "partners"
        ],
        "summary": "Transitions a partner's onboarding to a new stage (one step forward, or any\nstep back for rework).",
        "operationId": "transition_onboarding",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Partner ID",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Updated onboarding record",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OnboardingRecord"
                }
              }
            }
          },
          "404": {
            "description": "Onboarding not started"
          },
          "422": {
            "description": "Illegal transition"
          }
        }
      }
    },
    "/v1/partners/{id}/overlay": {
      "put": {
        "tags": [
          "partners"
        ],
        "summary": "Replace a partner's companion-guide **overlay** (extra segments + element\noverrides) without touching any other field \u2014 the save path behind the\nvisual mapping editor. Validate-before-publish is enforced: an overlay with\nblocking errors is rejected. An empty overlay clears it.",
        "operationId": "set_overlay",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Partner ID",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PartnerOverlay"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Overlay saved (returns the redacted partner + validation warnings)"
          },
          "422": {
            "description": "Overlay has blocking errors"
          }
        }
      }
    },
    "/v1/partners/{id}/publish-template": {
      "post": {
        "tags": [
          "partners"
        ],
        "summary": "Publishes a partner's guide+map to the shared library as a reusable template\n(relationship IDs and credentials stripped). Usually triggered automatically\non a certification pass; this is the explicit path.",
        "operationId": "publish_template",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Partner ID",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Published template",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerTemplate"
                }
              }
            }
          },
          "404": {
            "description": "Unknown partner"
          }
        }
      }
    },
    "/v1/partners/{id}/readiness": {
      "get": {
        "tags": [
          "partners"
        ],
        "operationId": "partner_readiness",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Partner ID",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Current configuration, evidence eligibility and production blockers",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReadinessResponse"
                }
              }
            }
          },
          "403": {
            "description": "Not this credential's partner"
          },
          "404": {
            "description": "Unknown partner"
          }
        }
      }
    },
    "/v1/partners/{id}/readiness/evidence": {
      "post": {
        "tags": [
          "partners"
        ],
        "operationId": "record_readiness_evidence",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Partner ID",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EvidenceSubmission"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Evidence recorded against the current partner configuration"
          },
          "422": {
            "description": "Invalid evidence"
          }
        }
      }
    },
    "/v1/partners/{id}/van/poll": {
      "post": {
        "tags": [
          "partners"
        ],
        "summary": "Poll a partner's file-backed VAN inbound mailbox.",
        "operationId": "van_poll",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Partner ID",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Files fetched from the partner's VAN mailbox"
          },
          "404": {
            "description": "Unknown partner"
          }
        }
      }
    },
    "/v1/partners/{id}/van/status": {
      "get": {
        "tags": [
          "partners"
        ],
        "summary": "File-backed VAN mailbox status for a partner.",
        "operationId": "van_status",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Partner ID",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "VAN mailbox status for the partner"
          },
          "404": {
            "description": "Unknown partner"
          }
        }
      }
    },
    "/v1/partners/{id}/xref/items": {
      "get": {
        "tags": [
          "partners"
        ],
        "operationId": "list_items",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Trading partner id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Item cross-references",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/ItemXref"
                  }
                }
              }
            }
          },
          "404": {
            "description": "Partner not found in this workspace"
          }
        },
        "security": [
          {
            "bearer": []
          }
        ]
      },
      "post": {
        "tags": [
          "partners"
        ],
        "operationId": "create_item",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Trading partner id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ItemXrefInput"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ItemXref"
                }
              }
            }
          },
          "409": {
            "description": "An identifier is already mapped for this partner"
          },
          "422": {
            "description": "Invalid input"
          }
        },
        "security": [
          {
            "bearer": []
          }
        ]
      }
    },
    "/v1/partners/{id}/xref/items/export": {
      "get": {
        "tags": [
          "partners"
        ],
        "operationId": "export_items",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Trading partner id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Item cross-references as CSV",
            "content": {
              "text/csv": {}
            }
          }
        },
        "security": [
          {
            "bearer": []
          }
        ]
      }
    },
    "/v1/partners/{id}/xref/items/import": {
      "post": {
        "tags": [
          "partners"
        ],
        "summary": "Bulk CSV import (header row required; columns `partner_item_id, upc,\nbuyer_part, sku, uom, pack_size, description` in any order, `sku`\nrequired). All-or-nothing; at most 10,000 rows per request.",
        "operationId": "import_items",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Trading partner id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "mode",
            "in": "query",
            "description": "merge (default) or replace",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "text/csv": {
              "schema": {
                "type": "string"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Import applied",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ImportSummary"
                }
              }
            }
          },
          "409": {
            "description": "Duplicate identifiers"
          },
          "422": {
            "description": "Invalid CSV (row number in the message) or over the row cap"
          }
        },
        "security": [
          {
            "bearer": []
          }
        ]
      }
    },
    "/v1/partners/{id}/xref/items/{xref_id}": {
      "put": {
        "tags": [
          "partners"
        ],
        "operationId": "update_item",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Trading partner id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "xref_id",
            "in": "path",
            "description": "Cross-reference id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ItemXrefInput"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Updated",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ItemXref"
                }
              }
            }
          },
          "404": {
            "description": "Not found in this workspace/partner"
          },
          "409": {
            "description": "An identifier is already mapped for this partner"
          }
        },
        "security": [
          {
            "bearer": []
          }
        ]
      },
      "delete": {
        "tags": [
          "partners"
        ],
        "operationId": "delete_item",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Trading partner id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "xref_id",
            "in": "path",
            "description": "Cross-reference id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Deleted"
          },
          "404": {
            "description": "Not found in this workspace/partner"
          }
        },
        "security": [
          {
            "bearer": []
          }
        ]
      }
    },
    "/v1/partners/{id}/xref/locations": {
      "get": {
        "tags": [
          "partners"
        ],
        "operationId": "list_locations",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Trading partner id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Location cross-references",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/LocationXref"
                  }
                }
              }
            }
          },
          "404": {
            "description": "Partner not found in this workspace"
          }
        },
        "security": [
          {
            "bearer": []
          }
        ]
      },
      "post": {
        "tags": [
          "partners"
        ],
        "operationId": "create_location",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Trading partner id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LocationXrefInput"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LocationXref"
                }
              }
            }
          },
          "409": {
            "description": "Partner location already mapped"
          },
          "422": {
            "description": "Invalid input"
          }
        },
        "security": [
          {
            "bearer": []
          }
        ]
      }
    },
    "/v1/partners/{id}/xref/locations/export": {
      "get": {
        "tags": [
          "partners"
        ],
        "operationId": "export_locations",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Trading partner id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Location cross-references as CSV",
            "content": {
              "text/csv": {}
            }
          }
        },
        "security": [
          {
            "bearer": []
          }
        ]
      }
    },
    "/v1/partners/{id}/xref/locations/import": {
      "post": {
        "tags": [
          "partners"
        ],
        "summary": "Bulk CSV import (columns `partner_location_id, location_id, ship_to,\nlocation_type, description`; the first two required). All-or-nothing; at\nmost 10,000 rows per request.",
        "operationId": "import_locations",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Trading partner id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "mode",
            "in": "query",
            "description": "merge (default) or replace",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "text/csv": {
              "schema": {
                "type": "string"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Import applied",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ImportSummary"
                }
              }
            }
          },
          "409": {
            "description": "Duplicate partner locations"
          },
          "422": {
            "description": "Invalid CSV (row number in the message) or over the row cap"
          }
        },
        "security": [
          {
            "bearer": []
          }
        ]
      }
    },
    "/v1/partners/{id}/xref/locations/{xref_id}": {
      "put": {
        "tags": [
          "partners"
        ],
        "operationId": "update_location",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Trading partner id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "xref_id",
            "in": "path",
            "description": "Cross-reference id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LocationXrefInput"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Updated",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LocationXref"
                }
              }
            }
          },
          "404": {
            "description": "Not found in this workspace/partner"
          },
          "409": {
            "description": "Partner location already mapped"
          }
        },
        "security": [
          {
            "bearer": []
          }
        ]
      },
      "delete": {
        "tags": [
          "partners"
        ],
        "operationId": "delete_location",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Trading partner id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "xref_id",
            "in": "path",
            "description": "Cross-reference id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Deleted"
          },
          "404": {
            "description": "Not found in this workspace/partner"
          }
        },
        "security": [
          {
            "bearer": []
          }
        ]
      }
    },
    "/v1/reconciliation": {
      "get": {
        "tags": [
          "operations"
        ],
        "summary": "Acknowledgment status of outbound documents (matched against inbound 997s).",
        "operationId": "reconciliation",
        "parameters": [
          {
            "name": "outstanding",
            "in": "query",
            "description": "Only un-acknowledged documents",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "overdue",
            "in": "query",
            "description": "Only documents overdue past the ack SLA",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Most documents returned (default 500, max 5000); counts always cover everything",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Outbound documents and their 997 status",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/OutboundAck"
                  }
                }
              }
            }
          },
          "403": {
            "description": "Admin credential required"
          }
        }
      }
    },
    "/v1/replay/{reference}": {
      "post": {
        "tags": [
          "operations"
        ],
        "summary": "Replays a document set from the stream: re-derives the VES events for every\nstored **inbound** document under `reference` (PO / shipment / invoice).\nIdempotent by construction \u2014 each event's deterministic ID collapses in the\noutbox and the sequencer, so a replay produces no duplicate orders, acks, or\ndeliveries. This is the sandbox demonstration of replay-from-stream.",
        "operationId": "replay_reference",
        "parameters": [
          {
            "name": "reference",
            "in": "path",
            "description": "PO / shipment / invoice reference",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "partner_id",
            "in": "query",
            "description": "Select the partner explicitly when a reference occurs in multiple relationships.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Replay summary per document"
          },
          "403": {
            "description": "Admin credential required"
          },
          "404": {
            "description": "No inbound documents for the reference"
          }
        }
      }
    },
    "/v1/retailer-profiles": {
      "get": {
        "tags": [
          "operations"
        ],
        "summary": "Lists the built-in retailer companion-guide profiles (Walmart, Target,\nAmazon, plus Sephora/Ulta placeholders). Public: the \"which retailers do you\nsupport\" surface behind the marketing site and the free compliance checker.",
        "operationId": "list_retailer_profiles",
        "responses": {
          "200": {
            "description": "Built-in retailer companion-guide profiles"
          }
        }
      }
    },
    "/v1/retailer-profiles/{key}/certification-pack": {
      "get": {
        "tags": [
          "operations"
        ],
        "summary": "Returns the auto-generated certification pack for a retailer profile \u2014 the\nexact compliant + rejection cases that certify a relationship against that\nretailer's guide. Public, so a prospect can see what conformance requires.",
        "operationId": "retailer_certification_pack",
        "parameters": [
          {
            "name": "key",
            "in": "path",
            "description": "Retailer profile key, e.g. walmart",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Generated certification test pack"
          },
          "404": {
            "description": "Unknown retailer profile"
          }
        }
      }
    },
    "/v1/retailer-profiles/{key}/check": {
      "post": {
        "tags": [
          "operations"
        ],
        "summary": "Free compliance checker: validate a raw X12 file against a retailer's\npublished implementation guide, with no account and no side effects. Returns\nthe per-document conformance verdict and every guide violation. This is the\nlead-magnet engine \u2014 a supplier pastes the PO/ASN their retailer rejected and\nsees exactly why.",
        "operationId": "check_retailer_profile",
        "parameters": [
          {
            "name": "key",
            "in": "path",
            "description": "Retailer profile key, e.g. walmart / target / amazon",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "description": "Raw X12 interchange",
          "content": {
            "application/edi-x12": {
              "schema": {
                "type": "string"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Conformance report against the retailer's guide"
          },
          "404": {
            "description": "Unknown retailer profile"
          }
        }
      }
    },
    "/v1/retailer-profiles/{key}/sample": {
      "get": {
        "tags": [
          "operations"
        ],
        "summary": "Returns a ready-to-edit, guide-compliant sample 850 for a retailer profile \u2014\npublic, so the checker/landing page can prefill a per-retailer example.",
        "operationId": "retailer_profile_sample",
        "parameters": [
          {
            "name": "key",
            "in": "path",
            "description": "Retailer profile key, e.g. walmart",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A compliant sample X12 850",
            "content": {
              "application/edi-x12": {}
            }
          },
          "404": {
            "description": "Unknown retailer profile"
          }
        }
      }
    },
    "/v1/sandbox/{partner_id}/scenarios/{scenario}": {
      "post": {
        "tags": [
          "inbound"
        ],
        "summary": "Runs a retailer sandbox scenario for a **test** partner: synthesizes the\ndocuments the retailer would send and processes them through the normal\ninbound pipeline (guide validation, 997, events, document log) exactly as if\nthe retailer had sent them. Scenarios: `po` (an 850), `po_change` (850 then\nan 860 quantity change on line 1), `po_cancel` (850 then an 860 cancel),\n`bad_po` (an 850 missing BEG03, showing the rejection and its 997). The body\nis optional (`po_number`, `lines`, `new_quantity`). Refused with 409 for a\nproduction (`usage: P`) partner.",
        "operationId": "sandbox_scenario",
        "parameters": [
          {
            "name": "partner_id",
            "in": "path",
            "description": "Test partner ID",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "scenario",
            "in": "path",
            "description": "po | po_change | po_cancel | bad_po",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "description": "Optional PO overrides",
          "content": {
            "application/json": {
              "schema": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/SandboxRequest"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Per-step processing results: document ids, statuses, and generated acknowledgments"
          },
          "403": {
            "description": "Not this credential's partner"
          },
          "404": {
            "description": "Unknown partner"
          },
          "409": {
            "description": "Partner is not a test (usage T) partner"
          },
          "422": {
            "description": "Unknown scenario or invalid body"
          }
        }
      }
    },
    "/v1/signing-key": {
      "get": {
        "tags": [
          "operations"
        ],
        "summary": "Returns the Ed25519 public key used to sign VES events, plus a ready-made\npayload for registering it with the sequencer's `POST /v1/agents/keys`.",
        "operationId": "signing_key",
        "responses": {
          "200": {
            "description": "The active signing public key"
          },
          "403": {
            "description": "Admin credential required"
          },
          "404": {
            "description": "Signing is disabled"
          }
        }
      }
    },
    "/v1/sscc/allocate": {
      "post": {
        "tags": [
          "outbound"
        ],
        "summary": "Allocates fresh SSCC-18 codes from the tenant's durable, monotonic serial\ncounter (per GS1 company prefix). Codes are never reissued, carry a valid\nGS1 check digit, and are what the label endpoints use for blank/`auto`\nSSCCs. Any credential in the tenant may allocate, but partner-scoped\ncredentials are capped per request (`EDI_SSCC_PARTNER_MAX_COUNT`, default\n10): serials are never reissued, so an uncapped partner key could burn\nthe tenant's GS1 serial space. Tenant/admin credentials keep the store\nceiling (1000).",
        "operationId": "allocate_sscc",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SsccAllocateRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Allocated SSCC-18 codes"
          },
          "422": {
            "description": "Invalid count, no GS1 company prefix, or serial space exhausted"
          }
        }
      }
    },
    "/v1/status-board": {
      "get": {
        "tags": [
          "operations"
        ],
        "summary": "Per-partner operational status board: volume, compliance rate, open\nexceptions, and last activity, derived from the documents log and ack SLA.",
        "operationId": "status_board",
        "responses": {
          "200": {
            "description": "Per-partner operational health",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/StatusBoardEntry"
                  }
                }
              }
            }
          },
          "403": {
            "description": "Admin credential required"
          }
        }
      }
    },
    "/v1/templates": {
      "get": {
        "tags": [
          "partners"
        ],
        "summary": "Browses the cross-tenant template library (most-reused first) with a\nnetwork-effect summary. A template certified by any tenant is inheritable\nhere.",
        "operationId": "list_templates",
        "responses": {
          "200": {
            "description": "Shared partner templates + library summary",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/PartnerTemplate"
                  }
                }
              }
            }
          },
          "403": {
            "description": "Admin credential required"
          }
        }
      }
    },
    "/v1/templates/{id}": {
      "get": {
        "tags": [
          "partners"
        ],
        "summary": "One shared partner template.",
        "operationId": "get_template",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Template ID",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Partner template",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerTemplate"
                }
              }
            }
          },
          "404": {
            "description": "Unknown template"
          }
        }
      }
    },
    "/v1/templates/{template_id}/instantiate/{partner_id}": {
      "post": {
        "tags": [
          "partners"
        ],
        "summary": "Inherits a shared template into the caller's tenant: creates a trading\npartner from the template's guide+map plus the relationship identifiers in\nthe body, and increments the template's reuse count (the flywheel turning).",
        "operationId": "instantiate_template",
        "parameters": [
          {
            "name": "template_id",
            "in": "path",
            "description": "Template to inherit",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "partner_id",
            "in": "path",
            "description": "Internal partner ID to create",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ConnectorPartnerParams"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Created partner (key hash redacted)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TradingPartner"
                }
              }
            }
          },
          "404": {
            "description": "Unknown template"
          }
        }
      }
    },
    "/v1/tenants": {
      "get": {
        "tags": [
          "partners"
        ],
        "summary": "Lists tenants. Admin-only; the platform operator sees the full catalog.",
        "operationId": "list_tenants",
        "responses": {
          "200": {
            "description": "All tenants",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Tenant"
                  }
                }
              }
            }
          },
          "403": {
            "description": "Admin credential required"
          }
        }
      },
      "post": {
        "tags": [
          "partners"
        ],
        "summary": "Provisions (or updates) a tenant. Used by the dashboard gateway to create a\ntenant per WorkOS organization. Requires Postgres.",
        "operationId": "create_tenant",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Tenant"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "The provisioned tenant",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Tenant"
                }
              }
            }
          },
          "403": {
            "description": "Admin credential required"
          },
          "422": {
            "description": "Single-tenant deployment (no DATABASE_URL)"
          }
        }
      }
    },
    "/v1/tenants/{id}": {
      "get": {
        "tags": [
          "partners"
        ],
        "operationId": "get_tenant",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Tenant ID",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Tenant record",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Tenant"
                }
              }
            }
          },
          "404": {
            "description": "Unknown tenant"
          }
        }
      }
    },
    "/v1/tenants/{id}/api-keys": {
      "get": {
        "tags": [
          "partners"
        ],
        "summary": "Lists a tenant's API keys (metadata only \u2014 hashes are never returned).\nPlatform-admin only.",
        "operationId": "list_tenant_keys",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Tenant ID",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The tenant's API keys"
          }
        }
      },
      "post": {
        "tags": [
          "partners"
        ],
        "summary": "Mints a tenant-scoped API key for external REST callers. The key authenticates\nas the tenant (full access within it, no platform operations). The plaintext\nis returned **once** and never stored. Platform-admin only.",
        "operationId": "mint_tenant_key",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Tenant ID",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MintTenantKeyBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "The new key \u2014 plaintext shown once"
          },
          "403": {
            "description": "Platform-admin credential required"
          },
          "404": {
            "description": "Unknown tenant"
          }
        }
      }
    },
    "/v1/tenants/{id}/api-keys/{key_id}": {
      "delete": {
        "tags": [
          "partners"
        ],
        "summary": "Revokes (deletes) a tenant API key. The key stops authenticating immediately.\nPlatform-admin only.",
        "operationId": "revoke_tenant_key",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Tenant ID",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "key_id",
            "in": "path",
            "description": "Key ID",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Key revoked"
          },
          "404": {
            "description": "Unknown key"
          }
        }
      }
    },
    "/v1/transport/operations": {
      "get": {
        "tags": [
          "operations"
        ],
        "summary": "Transport operations center: AS2/SFTP/VAN/cert/MDN go-live posture.",
        "operationId": "transport_operations",
        "responses": {
          "200": {
            "description": "Per-partner transport + certificate posture"
          }
        }
      }
    },
    "/v1/usage": {
      "get": {
        "tags": [
          "operations"
        ],
        "summary": "The tenant's consumption ledger rollup \u2014 documents processed and\ngenerated, delivery attempts \u2014 per kind, transaction set, and partner.\nThe billing-grade counterpart to the Prometheus counters.",
        "operationId": "usage_summary",
        "parameters": [
          {
            "name": "from",
            "in": "query",
            "description": "Period start (RFC 3339). Defaults to 30 days ago.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ],
              "format": "date-time"
            }
          },
          {
            "name": "to",
            "in": "query",
            "description": "Period end, exclusive (RFC 3339). Defaults to now.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ],
              "format": "date-time"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Aggregated consumption for the period",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UsageSummary"
                }
              }
            }
          },
          "403": {
            "description": "Admin or tenant credential required"
          }
        }
      }
    },
    "/v1/van/providers": {
      "get": {
        "tags": [
          "operations"
        ],
        "summary": "Supported VAN providers and whether the local file-backed VAN is enabled.",
        "operationId": "van_providers",
        "responses": {
          "200": {
            "description": "Supported VAN providers"
          }
        }
      }
    },
    "/v1/verify": {
      "post": {
        "tags": [
          "operations"
        ],
        "summary": "Independently verifies the Ed25519 signatures on a set of VES events. This\nis the buyer-facing proof of the verifiable-event architecture: anyone\nholding the public key can confirm an event chain is authentic and\nuntampered. The same check runs client-side with `signing::verify`.",
        "operationId": "verify_events",
        "responses": {
          "200": {
            "description": "Per-event verification result"
          },
          "422": {
            "description": "No public key available or unparseable body"
          }
        }
      }
    },
    "/v1/workspace": {
      "get": {
        "tags": [
          "partners"
        ],
        "operationId": "workspace",
        "responses": {
          "200": {
            "description": "Current workspace"
          }
        }
      }
    },
    "/v1/workspace/bootstrap": {
      "post": {
        "tags": [
          "partners"
        ],
        "operationId": "bootstrap_workspace",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WorkspaceSetup"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Provision this credential's workspace"
          },
          "403": {
            "description": "Workspace disabled or insufficient role"
          }
        }
      }
    },
    "/v1/x12/capabilities": {
      "get": {
        "tags": [
          "operations"
        ],
        "summary": "X12 capability discovery: the transaction sets the gateway can parse inbound\nand build outbound, and the envelope versions it supports. A buyer can\nconfirm coverage without a sales call.",
        "operationId": "x12_capabilities",
        "responses": {
          "200": {
            "description": "Supported transaction sets and X12 versions"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Ack855": {
        "type": "object",
        "required": [
          "po_number",
          "ack_date",
          "lines"
        ],
        "properties": {
          "ack_date": {
            "type": "string",
            "format": "date"
          },
          "ack_type": {
            "type": "string",
            "description": "BAK02 acknowledgment type: AC accept, AD accept with detail,\nAK acknowledge no detail, RJ reject."
          },
          "lines": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AckLine"
            }
          },
          "po_date": {
            "type": [
              "string",
              "null"
            ],
            "format": "date"
          },
          "po_number": {
            "type": "string"
          }
        }
      },
      "Ack855Overrides": {
        "type": "object",
        "description": "855 overrides. Listed lines change status and/or committed quantity;\nunlisted lines stay accepted. A quantity without a status becomes `IQ`\n(quantity changed) \u2014 or `IR` when zero.",
        "properties": {
          "ack_date": {
            "type": [
              "string",
              "null"
            ],
            "format": "date"
          },
          "ack_type": {
            "type": [
              "string",
              "null"
            ]
          },
          "lines": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AckLineOverride"
            }
          }
        },
        "additionalProperties": false
      },
      "Ack865": {
        "type": "object",
        "required": [
          "po_number",
          "ack_date",
          "lines"
        ],
        "properties": {
          "ack_date": {
            "type": "string",
            "format": "date"
          },
          "ack_type": {
            "type": "string",
            "description": "BCA02 acknowledgment type: AC accept, AD accept with detail,\nAK acknowledge no detail, RJ reject."
          },
          "lines": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ChangeAckLine"
            }
          },
          "po_date": {
            "type": [
              "string",
              "null"
            ],
            "format": "date",
            "description": "BCA06 \u2014 original PO date."
          },
          "po_number": {
            "type": "string",
            "description": "BCA03 \u2014 the changed PO being acknowledged."
          }
        }
      },
      "Ack997": {
        "type": "object",
        "description": "A parsed (or to-be-generated) functional acknowledgment.",
        "required": [
          "functional_code",
          "group_control_number",
          "group_status",
          "included",
          "received",
          "accepted",
          "transactions"
        ],
        "properties": {
          "accepted": {
            "type": "integer",
            "minimum": 0
          },
          "functional_code": {
            "type": "string",
            "description": "AK101 \u2014 functional code of the group being acknowledged."
          },
          "group_control_number": {
            "type": "string",
            "description": "AK102 \u2014 GS06 control number of the group being acknowledged."
          },
          "group_status": {
            "type": "string",
            "description": "AK901 \u2014 A accepted, E accepted with errors, R rejected, P partial."
          },
          "included": {
            "type": "integer",
            "description": "AK902/AK903/AK904 \u2014 included / received / accepted counts.",
            "minimum": 0
          },
          "received": {
            "type": "integer",
            "minimum": 0
          },
          "transactions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TxAck"
            }
          }
        }
      },
      "AckLine": {
        "type": "object",
        "required": [
          "line_number",
          "quantity"
        ],
        "properties": {
          "ids": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ProductId"
            }
          },
          "line_number": {
            "type": "string"
          },
          "quantity": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "description": "ACK01 line status: IA item accepted, IB backordered, IQ quantity\nchanged, IR item rejected."
          },
          "status_quantity": {
            "type": [
              "string",
              "null"
            ],
            "description": "ACK02 \u2014 quantity the status applies to; defaults to the line quantity."
          },
          "unit_price": {
            "type": [
              "string",
              "null"
            ]
          },
          "uom": {
            "type": "string"
          }
        }
      },
      "AckLineOverride": {
        "type": "object",
        "required": [
          "line_number"
        ],
        "properties": {
          "line_number": {
            "type": "string",
            "description": "The PO line (PO101) being acknowledged."
          },
          "quantity": {
            "type": [
              "string",
              "null"
            ],
            "description": "ACK02 \u2014 the quantity committed."
          },
          "status": {
            "type": [
              "string",
              "null"
            ],
            "description": "ACK01: IA accepted, IB backordered, IQ quantity changed, IR rejected."
          }
        },
        "additionalProperties": false
      },
      "AckLineParsed": {
        "type": "object",
        "properties": {
          "ids": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ProductId"
            }
          },
          "line_number": {
            "type": [
              "string",
              "null"
            ]
          },
          "quantity": {
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "type": [
              "string",
              "null"
            ],
            "description": "ACK01 line status: IA accepted, IB backordered, IR rejected,\nIQ quantity changed."
          },
          "status_quantity": {
            "type": [
              "string",
              "null"
            ],
            "description": "ACK02 \u2014 quantity the status applies to."
          },
          "uom": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "ActiveAlert": {
        "type": "object",
        "description": "An active monitoring alert.",
        "required": [
          "severity",
          "kind",
          "message",
          "count"
        ],
        "properties": {
          "count": {
            "type": "integer",
            "minimum": 0
          },
          "kind": {
            "type": "string",
            "description": "`sla_breach`, `deadletter`, `delivery_failure`, or `as2_receipt_failure`."
          },
          "message": {
            "type": "string"
          },
          "partner_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "severity": {
            "type": "string",
            "description": "`warning` or `critical`."
          }
        }
      },
      "AdapterAction": {
        "type": "object",
        "description": "A planned back-end action for one event \u2014 what a live adapter would perform.",
        "required": [
          "adapter",
          "target_system",
          "operation",
          "event_type",
          "entity_type",
          "entity_id"
        ],
        "properties": {
          "adapter": {
            "type": "string"
          },
          "entity_id": {
            "type": "string"
          },
          "entity_type": {
            "type": "string"
          },
          "event_type": {
            "type": "string"
          },
          "operation": {
            "type": "string",
            "description": "Human-readable operation, e.g. `create sales order`."
          },
          "target_system": {
            "type": "string"
          }
        }
      },
      "AdapterConnectionInput": {
        "oneOf": [
          {
            "$ref": "#/components/schemas/ShopifyConnectionInput"
          },
          {
            "$ref": "#/components/schemas/NetSuiteConnectionInput"
          }
        ],
        "description": "Body of `PUT /v1/adapters/{name}/connection`; the fields depend on the\nadapter named in the path."
      },
      "AdapterConnectionView": {
        "type": "object",
        "description": "A stored connection as returned by the API: metadata only, never secrets.",
        "required": [
          "id",
          "adapter",
          "metadata",
          "updated_by",
          "created_at",
          "updated_at"
        ],
        "properties": {
          "adapter": {
            "type": "string"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "id": {
            "type": "string"
          },
          "metadata": {
            "type": "object",
            "description": "Non-secret connection facts (shop domain, API version, account id,\nRESTlet host, auth type)."
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_by": {
            "type": "string"
          }
        }
      },
      "AdapterDescriptor": {
        "type": "object",
        "description": "A packaged back-end adapter's capability profile.",
        "required": [
          "name",
          "display_name",
          "vendor",
          "kind",
          "status",
          "consumes_events",
          "emits_documents",
          "notes"
        ],
        "properties": {
          "consumes_events": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Inbound canonical VES event types this adapter writes into the back end."
          },
          "display_name": {
            "type": "string"
          },
          "emits_documents": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Outbound X12 transaction sets this adapter originates from back-end state."
          },
          "kind": {
            "$ref": "#/components/schemas/AdapterKind"
          },
          "name": {
            "type": "string",
            "description": "Stable lookup key, e.g. `netsuite`."
          },
          "notes": {
            "type": "string"
          },
          "status": {
            "$ref": "#/components/schemas/AdapterStatus"
          },
          "vendor": {
            "type": "string"
          }
        }
      },
      "AdapterExecution": {
        "type": "object",
        "description": "Receipt from a live adapter API call. Secrets and response bodies are never\nreturned: operators get the vendor request id and HTTP outcome only.",
        "required": [
          "adapter",
          "event_id",
          "operation",
          "status"
        ],
        "properties": {
          "adapter": {
            "type": "string"
          },
          "event_id": {
            "type": "string"
          },
          "operation": {
            "type": "string"
          },
          "status": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "vendor_request_id": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "AdapterKind": {
        "type": "string",
        "description": "The class of system an adapter integrates.",
        "enum": [
          "erp",
          "wms",
          "tms",
          "ecommerce",
          "carrier"
        ]
      },
      "AdapterStatus": {
        "type": "string",
        "description": "Delivery maturity of a packaged adapter.",
        "enum": [
          "ga",
          "beta",
          "planned"
        ]
      },
      "Address": {
        "type": "object",
        "description": "A flattened postal block for rendering.",
        "required": [
          "name"
        ],
        "properties": {
          "lines": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "locality": {
            "type": "string"
          },
          "name": {
            "type": "string"
          }
        }
      },
      "Adjustment812": {
        "type": "object",
        "required": [
          "adjustment_number"
        ],
        "properties": {
          "adjustment_date": {
            "type": [
              "string",
              "null"
            ],
            "format": "date",
            "description": "BCD01 (or BGN03) \u2014 adjustment date."
          },
          "adjustment_number": {
            "type": "string",
            "description": "BCD02 (or BGN02) \u2014 the adjustment / chargeback document number."
          },
          "amounts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AdjustmentAmount"
            },
            "description": "Monetary amounts by AMT01 qualifier."
          },
          "credit_debit_flag": {
            "type": [
              "string",
              "null"
            ],
            "description": "BCD05 \u2014 `C` credit (owed to the supplier) or `D` debit (deducted)."
          },
          "invoice_number": {
            "type": [
              "string",
              "null"
            ],
            "description": "The invoice the deduction is taken against, resolved from REF*IA/IV/IK."
          },
          "line_adjustments": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/LineAdjustment"
            },
            "description": "CDD line adjustments."
          },
          "parties": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Party"
            },
            "description": "N1 parties (RE remit-to, etc.)."
          },
          "po_number": {
            "type": [
              "string",
              "null"
            ],
            "description": "BCD09 \u2014 the purchase order the adjustment concerns."
          },
          "purpose": {
            "type": [
              "string",
              "null"
            ],
            "description": "BCD11 (or BGN01) \u2014 transaction purpose code (`00` original, \u2026)."
          },
          "reason_codes": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Adjustment reason codes seen in the document (ITA03 / ADX01 style)."
          },
          "references": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Reference"
            },
            "description": "All REF references, preserved by qualifier."
          },
          "total_amount": {
            "type": [
              "string",
              "null"
            ],
            "description": "Net deduction amount: the `TT` total when present, else the first amount."
          }
        }
      },
      "AdjustmentAmount": {
        "type": "object",
        "required": [
          "qualifier",
          "amount"
        ],
        "properties": {
          "amount": {
            "type": "string",
            "description": "AMT02 \u2014 monetary amount."
          },
          "qualifier": {
            "type": "string",
            "description": "AMT01 \u2014 amount qualifier code (`TT` total, `N` net, \u2026)."
          }
        }
      },
      "Advice945": {
        "type": "object",
        "required": [
          "order_number",
          "lines"
        ],
        "properties": {
          "carrier_scac": {
            "type": [
              "string",
              "null"
            ]
          },
          "lines": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AdviceLine"
            }
          },
          "order_number": {
            "type": "string",
            "description": "W0602 \u2014 our order number (echoed from the 940)."
          },
          "parties": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Party"
            }
          },
          "po_number": {
            "type": [
              "string",
              "null"
            ],
            "description": "W0606 \u2014 customer PO, when echoed."
          },
          "ship_date": {
            "type": [
              "string",
              "null"
            ],
            "format": "date",
            "description": "W0603."
          },
          "shipment_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "W0604 \u2014 the warehouse's shipment identification."
          },
          "total_units_shipped": {
            "type": [
              "string",
              "null"
            ],
            "description": "W0301 \u2014 total units shipped, when the warehouse provides it."
          },
          "transport_method": {
            "type": [
              "string",
              "null"
            ],
            "description": "W27 carrier detail."
          }
        }
      },
      "AdviceError": {
        "type": "object",
        "properties": {
          "code": {
            "type": [
              "string",
              "null"
            ],
            "description": "TED01 \u2014 application error condition code."
          },
          "description": {
            "type": [
              "string",
              "null"
            ],
            "description": "TED02 \u2014 free-form error description."
          }
        }
      },
      "AdviceItem": {
        "type": "object",
        "required": [
          "status",
          "status_code"
        ],
        "properties": {
          "errors": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AdviceError"
            },
            "description": "TED technical error descriptions attached to this item."
          },
          "group_control_number": {
            "type": [
              "string",
              "null"
            ],
            "description": "OTI08 \u2014 the group control number of the advised document."
          },
          "reference_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "OTI03 \u2014 the reference id of the document being advised (e.g. our invoice\nnumber)."
          },
          "reference_qualifier": {
            "type": [
              "string",
              "null"
            ],
            "description": "OTI02 \u2014 reference identification qualifier of the advised document."
          },
          "status": {
            "type": "string",
            "description": "Human-readable status mapped from OTI01: `accepted` (TA),\n`accepted_with_errors` (TE), `rejected` (TR), else the raw code."
          },
          "status_code": {
            "type": "string",
            "description": "OTI01 \u2014 raw application acknowledgment code."
          },
          "transaction_set": {
            "type": [
              "string",
              "null"
            ],
            "description": "OTI10 \u2014 the transaction set the advice concerns (e.g. `810`)."
          }
        }
      },
      "AdviceLine": {
        "type": "object",
        "required": [
          "status",
          "quantity_shipped"
        ],
        "properties": {
          "ids": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ProductId"
            },
            "description": "W1207+ qualifier/value pairs (W1206 UPC slot is folded in when set)."
          },
          "quantity_difference": {
            "type": [
              "string",
              "null"
            ]
          },
          "quantity_ordered": {
            "type": [
              "string",
              "null"
            ],
            "description": "W1202 / W1203 / W1204."
          },
          "quantity_shipped": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "description": "W1201 \u2014 shipment order status: CC shipped complete, CP partial,\nCN cancelled."
          },
          "uom": {
            "type": [
              "string",
              "null"
            ],
            "description": "W1205."
          }
        }
      },
      "Allowance": {
        "type": "object",
        "description": "One SAC allowance or charge. `amount` is a positive magnitude; `indicator`\n(`A` allowance / `C` charge) carries the direction.",
        "required": [
          "indicator",
          "code",
          "amount"
        ],
        "properties": {
          "amount": {
            "type": "string",
            "description": "SAC05 \u2014 amount in the invoice currency (serialized N2, two implied\ndecimals)."
          },
          "code": {
            "type": "string",
            "description": "SAC02 \u2014 service/promotion/allowance/charge code, e.g. `D240` freight,\n`A170` discount, `G830` handling."
          },
          "description": {
            "type": [
              "string",
              "null"
            ],
            "description": "SAC15 \u2014 free-text description."
          },
          "indicator": {
            "type": "string",
            "description": "SAC01 \u2014 `A` allowance (reduces the invoice), `C` charge (adds to it)."
          }
        }
      },
      "AnalyticsReport": {
        "type": "object",
        "description": "The full analytics report.",
        "required": [
          "total_documents",
          "inbound",
          "outbound",
          "accepted",
          "rejected",
          "by_partner",
          "by_transaction_set",
          "by_day",
          "cycle_time"
        ],
        "properties": {
          "accepted": {
            "type": "integer",
            "minimum": 0
          },
          "by_day": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DayVolume"
            }
          },
          "by_partner": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PartnerVolume"
            }
          },
          "by_transaction_set": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SetVolume"
            }
          },
          "cycle_time": {
            "$ref": "#/components/schemas/CycleTime"
          },
          "error_rate": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int32",
            "description": "Overall error rate, percent 0\u2013100.",
            "minimum": 0
          },
          "inbound": {
            "type": "integer",
            "minimum": 0
          },
          "outbound": {
            "type": "integer",
            "minimum": 0
          },
          "rejected": {
            "type": "integer",
            "minimum": 0
          },
          "total_documents": {
            "type": "integer",
            "minimum": 0
          }
        }
      },
      "AppAdvice824": {
        "type": "object",
        "required": [
          "items"
        ],
        "properties": {
          "date": {
            "type": [
              "string",
              "null"
            ],
            "description": "BGN03 \u2014 date (CCYYMMDD), as transmitted."
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AdviceItem"
            }
          },
          "purpose": {
            "type": [
              "string",
              "null"
            ],
            "description": "BGN01 \u2014 transaction set purpose code."
          },
          "reference_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "BGN02 \u2014 the advice's own reference id."
          }
        }
      },
      "As1Config": {
        "type": "object",
        "description": "Per-partner AS1 settings: the address we email outbound documents to.",
        "required": [
          "partner_email"
        ],
        "properties": {
          "partner_email": {
            "type": "string",
            "description": "The partner mailbox that receives our EDI attachments."
          }
        }
      },
      "As1InboundAttachment": {
        "type": "object",
        "description": "One attachment on an inbound AS1 email.",
        "properties": {
          "base64": {
            "type": "boolean"
          },
          "content": {
            "type": "string",
            "description": "Attachment content: base64 when `base64` is true, otherwise plain text."
          },
          "content_type": {
            "type": "string"
          },
          "filename": {
            "type": "string"
          }
        }
      },
      "As1InboundEmail": {
        "type": "object",
        "description": "An inbound EDI email forwarded to us by the mail service (the AS1 receive\npath). The mail service parses the raw message and POSTs this to\n`/v1/as1/inbound`; we extract the interchange and run it through the normal\ninbound pipeline (parse \u2192 validate \u2192 acknowledge \u2192 translate \u2192 sync).",
        "properties": {
          "attachments": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/As1InboundAttachment"
            },
            "description": "Decoded attachments; the EDI is normally the first `application/edi-*`."
          },
          "body": {
            "type": "string",
            "description": "Plain-text body \u2014 the fallback EDI source when there is no attachment."
          },
          "from": {
            "type": "string",
            "description": "Sender address, for logging/audit."
          },
          "partner_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "Optional explicit partner id; when absent the ISA sender resolves it."
          },
          "subject": {
            "type": "string"
          }
        }
      },
      "As2Config": {
        "type": "object",
        "description": "Per-partner AS2 relationship settings. Lives alongside the X12 envelope\nconfig on a trading partner; absent for partners that exchange files only.",
        "required": [
          "our_as2_id",
          "partner_as2_id",
          "partner_url"
        ],
        "properties": {
          "compress_outbound": {
            "type": "boolean",
            "description": "Compress outbound payloads (CMS CompressedData, RFC 5402). Applied\ninnermost: compress \u2192 sign \u2192 encrypt."
          },
          "encrypt_outbound": {
            "type": "boolean",
            "description": "Encrypt outbound payloads (S/MIME). Requires a [`Security`] signer."
          },
          "mdn_mode": {
            "$ref": "#/components/schemas/MdnMode",
            "description": "How the partner returns MDN receipts."
          },
          "mic_algorithm": {
            "$ref": "#/components/schemas/MicAlgorithm",
            "description": "MIC algorithm requested for the MDN and used to verify receipts."
          },
          "our_as2_id": {
            "type": "string",
            "description": "Our AS2 identifier (the value partners address messages to)."
          },
          "partner_as2_id": {
            "type": "string",
            "description": "The partner's AS2 identifier."
          },
          "partner_cert_pem": {
            "type": [
              "string",
              "null"
            ],
            "description": "The partner's X.509 certificate (PEM) \u2014 used to verify their inbound\nsignatures, authenticate MDNs, and encrypt outbound payloads for them."
          },
          "partner_receipt_delivery_url": {
            "type": [
              "string",
              "null"
            ],
            "description": "Trusted partner HTTPS endpoint for receipts of inbound async messages.\nMust exactly match their Receipt-Delivery-Option. Distinct from our\n`receipt_delivery_url`, which receives receipts for outbound messages."
          },
          "partner_url": {
            "type": "string",
            "description": "The partner's AS2 endpoint URL we POST outbound documents to."
          },
          "receipt_delivery_url": {
            "type": [
              "string",
              "null"
            ],
            "description": "Public HTTPS callback endpoint for asynchronous receipts. Required when\n`mdn_mode` is `async`; sent as `Receipt-Delivery-Option` (RFC 4130)."
          },
          "request_signed_mdn": {
            "type": "boolean",
            "description": "Request a *signed* MDN (transport-level non-repudiation of receipt).\nRequires `partner_cert_pem`; unsigned or unverifiable receipts fail closed."
          },
          "require_encrypted_inbound": {
            "type": "boolean",
            "description": "Require inbound messages from this partner to be encrypted. When set, a\ncleartext inbound message is rejected with a failure MDN. Defaults to\n`false`."
          },
          "require_signed_inbound": {
            "type": "boolean",
            "description": "Require inbound messages from this partner to be signed. When set, an\nunsigned inbound message is rejected with a failure MDN instead of\nprocessed. Defaults to `false` (accept unsigned) to preserve existing\nbehavior; enable it \u2014 together with `partner_cert_pem` \u2014 to mandate\nmessage authentication for a partner. Verification of the signature\nitself still depends on a configured certificate."
          },
          "sign_outbound": {
            "type": "boolean",
            "description": "Sign outbound payloads (S/MIME). Requires a [`Security`] signer."
          }
        }
      },
      "As2ReceiptList": {
        "type": "object",
        "required": [
          "count",
          "receipts"
        ],
        "properties": {
          "count": {
            "type": "integer",
            "minimum": 0
          },
          "receipts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MdnCallbackSummary"
            }
          }
        }
      },
      "As2ReceiptListResponse": {
        "type": "object",
        "required": [
          "success",
          "data"
        ],
        "properties": {
          "data": {
            "$ref": "#/components/schemas/As2ReceiptList"
          },
          "success": {
            "type": "boolean"
          }
        }
      },
      "Asn856": {
        "type": "object",
        "required": [
          "shipment_id",
          "ship_date",
          "orders"
        ],
        "properties": {
          "bol_number": {
            "type": [
              "string",
              "null"
            ],
            "description": "REF*BM \u2014 bill of lading."
          },
          "carrier_scac": {
            "type": [
              "string",
              "null"
            ],
            "description": "TD503 \u2014 Standard Carrier Alpha Code."
          },
          "orders": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AsnOrder"
            }
          },
          "packages": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int32",
            "description": "TD101 / TD102 \u2014 packaging code and lading quantity (e.g. CTN25 \u00d7 3).",
            "minimum": 0
          },
          "ship_date": {
            "type": "string",
            "format": "date"
          },
          "ship_from": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/Party"
              },
              {
                "type": "null"
              }
            ]
          },
          "ship_time": {
            "type": [
              "string",
              "null"
            ],
            "description": "HHMM; defaults to 0000 on the wire when absent."
          },
          "ship_to": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/Party"
              },
              {
                "type": "null"
              }
            ]
          },
          "shipment_id": {
            "type": "string",
            "description": "BSN02 \u2014 shipment identification."
          },
          "tracking_number": {
            "type": [
              "string",
              "null"
            ],
            "description": "REF*CN \u2014 carrier pro / tracking number."
          },
          "transport_method": {
            "type": [
              "string",
              "null"
            ],
            "description": "TD504 \u2014 transportation method (M motor, A air, ...)."
          },
          "weight": {
            "type": [
              "string",
              "null"
            ],
            "description": "TD107/TD108 \u2014 total weight and unit."
          },
          "weight_uom": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "Asn856In": {
        "type": "object",
        "description": "Parsed inbound 856, flattening the S/O/I HL hierarchy into shipment-level\ndetail plus orders and their items.",
        "required": [
          "shipment_id",
          "orders"
        ],
        "properties": {
          "bol_number": {
            "type": [
              "string",
              "null"
            ],
            "description": "REF*BM."
          },
          "carrier_scac": {
            "type": [
              "string",
              "null"
            ],
            "description": "TD503."
          },
          "orders": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AsnOrderIn"
            }
          },
          "ship_date": {
            "type": [
              "string",
              "null"
            ],
            "format": "date",
            "description": "BSN03."
          },
          "shipment_id": {
            "type": "string",
            "description": "BSN02."
          },
          "tracking_number": {
            "type": [
              "string",
              "null"
            ],
            "description": "REF*CN."
          }
        }
      },
      "Asn856Overrides": {
        "type": "object",
        "description": "856 overrides. With `cartons`, the shipment is exactly the carton contents\n(S\u2192O\u2192P\u2192I with SSCC-18s); else with `lines`, exactly those line quantities;\nelse every line's remaining quantity.",
        "properties": {
          "bol_number": {
            "type": [
              "string",
              "null"
            ]
          },
          "carrier_scac": {
            "type": [
              "string",
              "null"
            ]
          },
          "cartons": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CartonOverride"
            }
          },
          "lines": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/LineQuantity"
            }
          },
          "packages": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int32",
            "minimum": 0
          },
          "ship_date": {
            "type": [
              "string",
              "null"
            ],
            "format": "date"
          },
          "ship_from": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/Party"
              },
              {
                "type": "null"
              }
            ]
          },
          "ship_time": {
            "type": [
              "string",
              "null"
            ]
          },
          "ship_to": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/Party"
              },
              {
                "type": "null"
              }
            ]
          },
          "shipment_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "tracking_number": {
            "type": [
              "string",
              "null"
            ]
          },
          "transport_method": {
            "type": [
              "string",
              "null"
            ]
          },
          "weight": {
            "type": [
              "string",
              "null"
            ]
          },
          "weight_uom": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "additionalProperties": false
      },
      "AsnItem": {
        "type": "object",
        "required": [
          "sku",
          "quantity"
        ],
        "properties": {
          "quantity": {
            "type": "string"
          },
          "sku": {
            "type": "string"
          },
          "sku_qualifier": {
            "type": "string",
            "description": "LIN qualifier for the identifier, e.g. SK / VN / UP."
          },
          "uom": {
            "type": "string"
          }
        }
      },
      "AsnItemIn": {
        "type": "object",
        "properties": {
          "quantity": {
            "type": [
              "string",
              "null"
            ],
            "description": "SN102."
          },
          "sku": {
            "type": [
              "string",
              "null"
            ],
            "description": "LIN03."
          },
          "sku_qualifier": {
            "type": [
              "string",
              "null"
            ],
            "description": "LIN02 \u2014 identifier qualifier."
          },
          "uom": {
            "type": [
              "string",
              "null"
            ],
            "description": "SN103."
          }
        }
      },
      "AsnOrder": {
        "type": "object",
        "required": [
          "po_number"
        ],
        "properties": {
          "cartons": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AsnPack"
            },
            "description": "Carton/pack level: each carton carries an SSCC-18 (emitted as `HL*\u2026*P`\nwith `MAN*GM`) and the items packed in it. When non-empty, the ASN uses\nthe S\u2192O\u2192P\u2192I hierarchy retailers like QVC require, and `items` is ignored."
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AsnItem"
            },
            "description": "Items shipped directly under the order (no carton breakdown). Used when\n`cartons` is empty."
          },
          "pallets": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AsnPallet"
            },
            "description": "Pallet (tare) level: each pallet carries its own SSCC-18 (emitted as\n`HL*\u2026*T` with `MAN*GM`) and the cartons stacked on it, giving the\nS\u2192O\u2192T\u2192P\u2192I hierarchy. Pallets are emitted before any loose `cartons`\n(cartons shipped under the order without a pallet). When non-empty,\n`items` is ignored. Empty by default, so existing payloads (and their\nwire output) are unchanged."
          },
          "po_number": {
            "type": "string",
            "description": "PRF01 \u2014 the buyer's PO number this shipment fulfills."
          }
        }
      },
      "AsnOrderIn": {
        "type": "object",
        "required": [
          "po_number"
        ],
        "properties": {
          "cartons": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AsnPackIn"
            },
            "description": "Cartons (HL*P) and the items packed in each, when the ASN is\ncarton-level."
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AsnItemIn"
            },
            "description": "Items reported directly under the order (no carton breakdown)."
          },
          "pallets": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AsnPalletIn"
            },
            "description": "Pallets (HL*T) and the cartons on each, when the ASN is tare-level.\nCartons nested under a pallet appear here, not in `cartons`."
          },
          "po_number": {
            "type": "string",
            "description": "PRF01 \u2014 the PO this shipment fulfills."
          }
        }
      },
      "AsnPack": {
        "type": "object",
        "required": [
          "sscc",
          "items"
        ],
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AsnItem"
            }
          },
          "sscc": {
            "type": "string",
            "description": "SSCC-18 marked on the carton's GS1-128 label (MAN*GM). Must match the\nphysical label so the carton scans against the ASN."
          }
        }
      },
      "AsnPackIn": {
        "type": "object",
        "required": [
          "items"
        ],
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AsnItemIn"
            }
          },
          "sscc": {
            "type": [
              "string",
              "null"
            ],
            "description": "MAN*GM \u2014 the carton's SSCC-18."
          }
        }
      },
      "AsnPallet": {
        "type": "object",
        "description": "A pallet (tare) and the cartons stacked on it.",
        "required": [
          "sscc"
        ],
        "properties": {
          "cartons": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AsnPack"
            },
            "description": "Cartons on this pallet; each is an `HL*\u2026*P` whose parent is the pallet."
          },
          "sscc": {
            "type": "string",
            "description": "SSCC-18 marked on the pallet's GS1-128 label (MAN*GM on the `HL*\u2026*T`)."
          }
        }
      },
      "AsnPalletIn": {
        "type": "object",
        "properties": {
          "cartons": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AsnPackIn"
            }
          },
          "sscc": {
            "type": [
              "string",
              "null"
            ],
            "description": "MAN*GM \u2014 the pallet's SSCC-18."
          }
        }
      },
      "AtRiskOrder": {
        "type": "object",
        "description": "An order with at least one variance \u2014 a chargeback risk.",
        "required": [
          "reference",
          "variance_count",
          "top_issue",
          "severity"
        ],
        "properties": {
          "reference": {
            "type": "string"
          },
          "severity": {
            "type": "string"
          },
          "top_issue": {
            "type": "string",
            "description": "The most severe variance kind on the order."
          },
          "variance_count": {
            "type": "integer",
            "minimum": 0
          }
        }
      },
      "AuditRecord": {
        "type": "object",
        "required": [
          "id",
          "tenant_id",
          "action",
          "actor_type",
          "actor_id",
          "target_type",
          "target_id",
          "metadata",
          "occurred_at"
        ],
        "properties": {
          "action": {
            "type": "string"
          },
          "actor_id": {
            "type": "string"
          },
          "actor_type": {
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "metadata": {},
          "occurred_at": {
            "type": "string",
            "format": "date-time"
          },
          "target_id": {
            "type": "string"
          },
          "target_type": {
            "type": "string"
          },
          "tenant_id": {
            "type": "string"
          }
        }
      },
      "AutoAck855": {
        "type": "string",
        "description": "Automatic 855 policy (see [`TradingPartner::auto_ack_855`]).",
        "enum": [
          "off",
          "accept_all"
        ]
      },
      "BisIssue": {
        "type": "object",
        "description": "A Peppol BIS Billing 3.0 validation finding, tagged with its rule id.",
        "required": [
          "rule",
          "severity",
          "message"
        ],
        "properties": {
          "message": {
            "type": "string"
          },
          "rule": {
            "type": "string",
            "description": "Rule identifier, e.g. `BR-02`, `PEPPOL-EN16931-R020`, `BR-CO-15`."
          },
          "severity": {
            "type": "string",
            "description": "`error` (an access point would reject) or `warning` (advisory)."
          }
        }
      },
      "CallbackInput": {
        "type": "object",
        "required": [
          "expected_version",
          "url",
          "secret",
          "enabled"
        ],
        "properties": {
          "enabled": {
            "type": "boolean"
          },
          "expected_version": {
            "type": "integer",
            "format": "int64"
          },
          "partner_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "secret": {
            "type": "string"
          },
          "url": {
            "type": "string"
          }
        },
        "additionalProperties": false
      },
      "CallbackRetry": {
        "type": "object",
        "required": [
          "note"
        ],
        "properties": {
          "note": {
            "type": "string"
          }
        },
        "additionalProperties": false
      },
      "CallbackState": {
        "type": "object",
        "required": [
          "enabled"
        ],
        "properties": {
          "enabled": {
            "type": "boolean"
          }
        },
        "additionalProperties": false
      },
      "CardinalityRule": {
        "type": "object",
        "description": "Bounds how many times a segment may occur in a transaction set.",
        "required": [
          "segment"
        ],
        "properties": {
          "max": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Maximum occurrences (`None` = unbounded).",
            "minimum": 0
          },
          "min": {
            "type": "integer",
            "description": "Minimum occurrences (0 = optional).",
            "minimum": 0
          },
          "segment": {
            "type": "string",
            "description": "Segment tag, e.g. `BEG`."
          }
        }
      },
      "CartonOverride": {
        "type": "object",
        "required": [
          "sscc",
          "items"
        ],
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/LineQuantity"
            }
          },
          "sscc": {
            "type": "string",
            "description": "SSCC-18 on the carton's GS1-128 label."
          }
        },
        "additionalProperties": false
      },
      "CaseDirection": {
        "type": "string",
        "enum": [
          "inbound",
          "outbound"
        ]
      },
      "CaseResult": {
        "type": "object",
        "description": "The outcome of one certification case.",
        "required": [
          "name",
          "expected_valid",
          "actual_valid",
          "passed"
        ],
        "properties": {
          "actual_valid": {
            "type": "boolean"
          },
          "detail": {
            "type": [
              "string",
              "null"
            ],
            "description": "Why the validator reached its verdict \u2014 structural error or the first\nrejected document's reason \u2014 surfaced so a failing case is debuggable."
          },
          "direction": {
            "$ref": "#/components/schemas/CaseDirection"
          },
          "expected_rejection": {
            "type": [
              "string",
              "null"
            ]
          },
          "expected_valid": {
            "type": "boolean"
          },
          "name": {
            "type": "string"
          },
          "passed": {
            "type": "boolean"
          },
          "transaction_set": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "CaseUpdate": {
        "type": "object",
        "required": [
          "revision",
          "owner",
          "workflow",
          "note"
        ],
        "properties": {
          "due_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "note": {
            "type": "string"
          },
          "owner": {
            "type": "string"
          },
          "revision": {
            "type": "integer",
            "format": "int64"
          },
          "workflow": {
            "type": "string"
          }
        },
        "additionalProperties": false
      },
      "Catalog832": {
        "type": "object",
        "required": [
          "items"
        ],
        "properties": {
          "catalog_number": {
            "type": [
              "string",
              "null"
            ],
            "description": "BCT02 \u2014 catalog number / identifier."
          },
          "description": {
            "type": [
              "string",
              "null"
            ],
            "description": "BCT07 \u2014 catalog description, when present."
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CatalogItem"
            }
          },
          "purpose": {
            "type": [
              "string",
              "null"
            ],
            "description": "BCT01 \u2014 catalog purpose code (e.g. `00` original, `01` cancel, `05`\nreplace)."
          }
        }
      },
      "CatalogChange": {
        "type": "object",
        "description": "One entry in an item's changelog.",
        "required": [
          "version",
          "at",
          "changed_fields"
        ],
        "properties": {
          "at": {
            "type": "string",
            "format": "date-time"
          },
          "changed_fields": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Which attributes changed (`description`, `prices`, `pack_size`, `ids`)."
          },
          "version": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          }
        }
      },
      "CatalogItem": {
        "type": "object",
        "properties": {
          "description": {
            "type": [
              "string",
              "null"
            ],
            "description": "PID-05 \u2014 free-form item description."
          },
          "ids": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ProductId"
            },
            "description": "LIN qualifier/value identifier pairs (UP UPC, VN vendor part, BP buyer\npart, \u2026)."
          },
          "pack_size": {
            "type": [
              "string",
              "null"
            ],
            "description": "PO4 pack size (PO4-01 inner pack quantity), when present."
          },
          "prices": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CatalogPrice"
            },
            "description": "CTP pricing by price type code (CTP-02 qualifier \u2192 CTP-03 price)."
          }
        }
      },
      "CatalogItemRecord": {
        "type": "object",
        "description": "One item in the master, with its change version.",
        "required": [
          "tenant_id",
          "partner_id",
          "sku",
          "version",
          "updated_at"
        ],
        "properties": {
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "history": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CatalogChange"
            },
            "description": "Append-only changelog of which attributes changed at each version bump."
          },
          "ids": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ProductId"
            }
          },
          "pack_size": {
            "type": [
              "string",
              "null"
            ]
          },
          "partner_id": {
            "type": "string"
          },
          "prices": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CatalogPrice"
            }
          },
          "sku": {
            "type": "string"
          },
          "tenant_id": {
            "type": "string"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "version": {
            "type": "integer",
            "format": "int32",
            "description": "Bumped each time the attributes change; 1 on first ingest.",
            "minimum": 0
          }
        }
      },
      "CatalogPrice": {
        "type": "object",
        "required": [
          "qualifier",
          "price"
        ],
        "properties": {
          "price": {
            "type": "string",
            "description": "CTP-03 unit price."
          },
          "qualifier": {
            "type": "string",
            "description": "CTP-02 price-qualifier code (e.g. `RES` resale, `UCP` unit cost, `LIS`\nlist). Defaults to an empty qualifier when the segment omits it."
          }
        }
      },
      "CategoryRecovery": {
        "type": "object",
        "description": "Deduction roll-up for one root-cause category.",
        "required": [
          "category",
          "count",
          "total_amount",
          "recovered_amount"
        ],
        "properties": {
          "category": {
            "type": "string"
          },
          "count": {
            "type": "integer",
            "minimum": 0
          },
          "recovered_amount": {
            "type": "string"
          },
          "total_amount": {
            "type": "string"
          }
        }
      },
      "CertificationReport": {
        "type": "object",
        "description": "The full certification report for a partner against a pack.",
        "required": [
          "partner_id",
          "pack_name",
          "passed",
          "total",
          "passed_count",
          "results"
        ],
        "properties": {
          "configuration_hash": {
            "type": "string",
            "description": "Readiness configuration captured before evaluating any sample."
          },
          "pack_hash": {
            "type": "string",
            "description": "SHA-256 of the serialized test pack, including sample payloads and expectations."
          },
          "pack_name": {
            "type": "string"
          },
          "partner_id": {
            "type": "string"
          },
          "passed": {
            "type": "boolean",
            "description": "True only when every case passed."
          },
          "passed_count": {
            "type": "integer",
            "minimum": 0
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CaseResult"
            }
          },
          "total": {
            "type": "integer",
            "minimum": 0
          },
          "usage": {
            "type": "string",
            "description": "Envelope environment of the immutable partner snapshot evaluated (T/P).\nReadiness hashes allow promotion, so this must be checked separately."
          }
        }
      },
      "CertificationResponse": {
        "type": "object",
        "required": [
          "success",
          "data",
          "advanced_to_certified",
          "published_template"
        ],
        "properties": {
          "advanced_to_certified": {
            "type": "boolean",
            "description": "Internal fixture runs never automatically advance onboarding."
          },
          "data": {
            "$ref": "#/components/schemas/CertificationReport"
          },
          "published_template": {
            "type": [
              "string",
              "null"
            ],
            "description": "Internal fixture runs never publish customer configuration as a template."
          },
          "success": {
            "type": "boolean",
            "description": "The request completed; inspect data.passed for the fixture verdict."
          }
        }
      },
      "ChangeAckLine": {
        "type": "object",
        "required": [
          "line_number",
          "quantity"
        ],
        "properties": {
          "change_type": {
            "type": "string",
            "description": "POC02 change/response type: CA changes, QD quantity decrease,\nQI quantity increase, DI delete item, AI add item, NC no change."
          },
          "ids": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ProductId"
            }
          },
          "line_number": {
            "type": "string"
          },
          "quantity": {
            "type": "string",
            "description": "POC03 \u2014 quantity ordered after the change."
          },
          "status": {
            "type": "string",
            "description": "ACK01 line status: IA accepted, IB backordered, IQ quantity changed,\nIR rejected."
          },
          "status_quantity": {
            "type": [
              "string",
              "null"
            ],
            "description": "ACK02 \u2014 quantity the status applies to; defaults to the line quantity."
          },
          "unit_price": {
            "type": [
              "string",
              "null"
            ]
          },
          "uom": {
            "type": "string"
          }
        }
      },
      "ChangeAckLineParsed": {
        "type": "object",
        "properties": {
          "change_type": {
            "type": [
              "string",
              "null"
            ]
          },
          "ids": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ProductId"
            }
          },
          "line_number": {
            "type": [
              "string",
              "null"
            ]
          },
          "quantity": {
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "type": [
              "string",
              "null"
            ]
          },
          "status_quantity": {
            "type": [
              "string",
              "null"
            ]
          },
          "uom": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "ChangeLine": {
        "type": "object",
        "required": [
          "line_number",
          "change_type"
        ],
        "properties": {
          "change_type": {
            "type": "string",
            "description": "POC02 \u2014 change type: AI add item, CA changes, DI delete item,\nQI quantity increase, QD quantity decrease, PC price change, RZ\nreplace all values."
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "ids": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ProductId"
            },
            "description": "POC08+ qualifier/value pairs."
          },
          "line_number": {
            "type": "string",
            "description": "POC01 \u2014 buyer's line number."
          },
          "quantity_left": {
            "type": [
              "string",
              "null"
            ]
          },
          "quantity_ordered": {
            "type": [
              "string",
              "null"
            ],
            "description": "POC03 / POC04 \u2014 quantity ordered and quantity left to receive."
          },
          "unit_price": {
            "type": [
              "string",
              "null"
            ],
            "description": "POC06 (POC07 is the basis)."
          },
          "uom": {
            "type": [
              "string",
              "null"
            ],
            "description": "POC05."
          }
        }
      },
      "CommercialInvoice": {
        "type": "object",
        "description": "The canonical commercial-invoice payload.",
        "required": [
          "invoice_number",
          "invoice_date",
          "seller",
          "buyer",
          "lines"
        ],
        "properties": {
          "buyer": {
            "$ref": "#/components/schemas/CustomsParty"
          },
          "currency": {
            "type": "string",
            "description": "ISO currency code the values are expressed in."
          },
          "freight": {
            "type": [
              "string",
              "null"
            ],
            "description": "Freight charge added to the customs value (when DDP/CIF style terms)."
          },
          "incoterms": {
            "type": [
              "string",
              "null"
            ],
            "description": "Incoterms 2020 three-letter rule, e.g. `DAP`, `DDP`, `EXW`."
          },
          "incoterms_place": {
            "type": [
              "string",
              "null"
            ],
            "description": "Named place for the incoterm, e.g. `Rotterdam`."
          },
          "insurance": {
            "type": [
              "string",
              "null"
            ],
            "description": "Insurance charge added to the customs value."
          },
          "invoice_date": {
            "type": "string"
          },
          "invoice_number": {
            "type": "string"
          },
          "lines": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CustomsLine"
            }
          },
          "po_number": {
            "type": [
              "string",
              "null"
            ]
          },
          "reason_for_export": {
            "type": [
              "string",
              "null"
            ],
            "description": "Why the goods are being exported (sale, sample, return, gift) \u2014 a CN22/23\nand many national customs forms require it."
          },
          "seller": {
            "$ref": "#/components/schemas/CustomsParty"
          },
          "ship_to": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/CustomsParty",
                "description": "Consignee, when goods ship to a different party than the buyer."
              },
              {
                "type": "null"
              }
            ]
          }
        }
      },
      "ComplianceIssue": {
        "type": "object",
        "description": "One pre-send compliance finding.",
        "required": [
          "code",
          "severity",
          "message"
        ],
        "properties": {
          "actual": {
            "type": [
              "string",
              "null"
            ]
          },
          "code": {
            "type": "string",
            "description": "Stable machine code: `missing_po`, `order_cancelled`, `unknown_item`,\n`item_mismatch`, `over_shipment`, `over_invoice`, `price_mismatch`,\n`ship_date_before_po_date`, `quantity_exceeds_order`, `empty_order`,\n`invalid_sscc`, `duplicate_sscc`, `missing_segment`,\n`missing_reference`, `invalid_invoice_total` (errors) and `uom_mismatch`, `po_date_mismatch`,\n`line_not_acknowledged`, `invoice_date_before_po_date`,\n`invoiced_exceeds_shipped`, `total_mismatch`, `missing_price`\n(warnings)."
          },
          "expected": {
            "type": [
              "string",
              "null"
            ]
          },
          "line_number": {
            "type": [
              "string",
              "null"
            ]
          },
          "message": {
            "type": "string"
          },
          "po_number": {
            "type": [
              "string",
              "null"
            ]
          },
          "severity": {
            "$ref": "#/components/schemas/IssueSeverity"
          },
          "sku": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "ConditionalRule": {
        "type": "object",
        "description": "An if-then implementation-guide rule: when the trigger element matches,\nthe listed requirements must hold. Covers the common companion-guide\npattern \"if BEG02 = SA then DTM is required\" that flat constraints can't\nexpress.",
        "required": [
          "when_segment",
          "when_element"
        ],
        "properties": {
          "equals": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Trigger values. Empty means \"when the element is present (non-empty)\"."
          },
          "require_element": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/ElementRef",
                "description": "Then this element must be present (non-empty) on every occurrence of\nits segment: tag + 1-based position."
              },
              {
                "type": "null"
              }
            ]
          },
          "require_segment": {
            "type": [
              "string",
              "null"
            ],
            "description": "Then this segment must be present somewhere in the transaction."
          },
          "when_element": {
            "type": "integer",
            "minimum": 0
          },
          "when_segment": {
            "type": "string",
            "description": "Trigger: segment tag + 1-based element position."
          }
        }
      },
      "ConformanceCheck": {
        "type": "object",
        "description": "One validated property of a generated artifact.",
        "required": [
          "name",
          "ok",
          "detail"
        ],
        "properties": {
          "detail": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "ok": {
            "type": "boolean"
          }
        }
      },
      "ConformanceResult": {
        "type": "object",
        "description": "The conformance verdict for one connector.",
        "required": [
          "connector",
          "partner_name",
          "passed",
          "checks"
        ],
        "properties": {
          "checks": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ConformanceCheck"
            }
          },
          "connector": {
            "type": "string"
          },
          "partner_name": {
            "type": "string"
          },
          "passed": {
            "type": "boolean"
          }
        }
      },
      "ConnectionInput": {
        "type": "object",
        "required": [
          "environment",
          "sync_tenant_id",
          "api_key",
          "webhook_secret"
        ],
        "properties": {
          "api_key": {
            "type": "string",
            "description": "Tenant-scoped API key issued by StateSet Sync, never a platform admin key."
          },
          "environment": {
            "type": "string"
          },
          "sync_tenant_id": {
            "type": "string"
          },
          "webhook_secret": {
            "type": "string",
            "description": "HMAC secret configured for this tenant on StateSet Sync."
          }
        },
        "additionalProperties": false
      },
      "ConnectionView": {
        "type": "object",
        "required": [
          "id",
          "environment",
          "sync_tenant_id",
          "active",
          "created_at"
        ],
        "properties": {
          "active": {
            "type": "boolean"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "environment": {
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "sync_tenant_id": {
            "type": "string"
          }
        }
      },
      "Connector": {
        "type": "object",
        "description": "A retailer EDI profile.",
        "required": [
          "name",
          "display_name",
          "partner_isa_qualifier",
          "version",
          "inbound_sets",
          "outbound_sets",
          "validation",
          "notes"
        ],
        "properties": {
          "category": {
            "type": "string",
            "description": "Retail vertical, e.g. `beauty`, `department`, `club`, `off-price`. Lets\ncallers narrow the catalog (a beauty vendor wants the beauty channels)."
          },
          "delimiters": {
            "$ref": "#/components/schemas/Delimiters"
          },
          "display_name": {
            "type": "string"
          },
          "inbound_sets": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Transaction sets the retailer sends us (we parse and acknowledge)."
          },
          "name": {
            "type": "string",
            "description": "Stable lookup key, e.g. `walmart`."
          },
          "notes": {
            "type": "string"
          },
          "outbound_sets": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Transaction sets we send the retailer."
          },
          "partner_isa_qualifier": {
            "type": "string",
            "description": "The retailer's typical ISA interchange ID qualifier (01 DUNS,\n08 UCC/EAN, 12 phone, ZZ mutually defined). Override per relationship."
          },
          "validation": {
            "$ref": "#/components/schemas/PartnerValidation",
            "description": "Starter implementation-guide validation applied to the partner."
          },
          "version": {
            "type": "string",
            "description": "GS08 version/release, e.g. `004010`."
          }
        }
      },
      "ConnectorManifest": {
        "type": "object",
        "description": "An authorable connector definition \u2014 the SDK's unit of distribution.",
        "required": [
          "name",
          "display_name",
          "partner_isa_qualifier",
          "version"
        ],
        "properties": {
          "category": {
            "type": "string"
          },
          "delimiters": {
            "$ref": "#/components/schemas/Delimiters"
          },
          "display_name": {
            "type": "string"
          },
          "inbound_sets": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Transaction sets the retailer sends (we parse + acknowledge)."
          },
          "name": {
            "type": "string",
            "description": "Stable lookup key, e.g. `acme-retail`."
          },
          "notes": {
            "type": "string"
          },
          "outbound_sets": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Transaction sets we send the retailer."
          },
          "overlay": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/PartnerOverlay",
                "description": "Optional outbound companion-guide overlay (extra segments / overrides)."
              },
              {
                "type": "null"
              }
            ]
          },
          "partner_isa_qualifier": {
            "type": "string",
            "description": "The retailer's ISA qualifier (01 DUNS, 08 UCC/EAN, 12 phone, ZZ)."
          },
          "validation": {
            "$ref": "#/components/schemas/PartnerValidation",
            "description": "Starter implementation-guide validation rules."
          },
          "version": {
            "type": "string",
            "description": "GS08 version/release, e.g. `004010`."
          }
        }
      },
      "ConnectorObservation": {
        "type": "object",
        "required": [
          "connector",
          "needs_attention"
        ],
        "properties": {
          "connector": {
            "type": "string"
          },
          "last_attempt_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "last_synced_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "needs_attention": {
            "type": "boolean"
          },
          "object_id": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "ConnectorPartnerParams": {
        "type": "object",
        "description": "Relationship-specific fields supplied when instantiating a partner from a\nconnector.",
        "required": [
          "partner_isa_id",
          "our_isa_qualifier",
          "our_isa_id"
        ],
        "properties": {
          "name": {
            "type": [
              "string",
              "null"
            ],
            "description": "Override the display name."
          },
          "our_isa_id": {
            "type": "string",
            "description": "Our ISA interchange ID (our DUNS or the ID the retailer assigned us)."
          },
          "our_isa_qualifier": {
            "type": "string",
            "description": "Our ISA qualifier for this relationship (often `01` DUNS or `ZZ`)."
          },
          "partner_isa_id": {
            "type": "string",
            "description": "The retailer's ISA interchange ID (their assigned identifier)."
          },
          "partner_isa_qualifier": {
            "type": [
              "string",
              "null"
            ],
            "description": "Override the connector's default partner ISA qualifier."
          },
          "usage": {
            "type": [
              "string",
              "null"
            ],
            "description": "`P` production (default) or `T` test."
          }
        }
      },
      "CountRule": {
        "type": "object",
        "description": "Each matching counter must equal the number of target segments across the\ntransaction/message. Supports scalar CTT totals and qualified composite CNT\ntotals. An absent matching counter is skipped; require it separately with\nrequired_segments or required_qualified.",
        "required": [
          "counter_segment",
          "counter_element",
          "counted_segment"
        ],
        "properties": {
          "counted_segment": {
            "type": "string",
            "description": "Segment being counted, e.g. `PO1`."
          },
          "counter_component": {
            "type": [
              "integer",
              "null"
            ],
            "description": "1-based component containing the count, e.g. 2 in `CNT+2:5`.\nUnset keeps the existing scalar/first-component behavior.",
            "minimum": 1
          },
          "counter_element": {
            "type": "integer",
            "description": "1-based element position of the count, e.g. `1`.",
            "minimum": 0
          },
          "counter_segment": {
            "type": "string",
            "description": "Segment carrying the count, e.g. `CTT`."
          },
          "qualifier_element": {
            "type": [
              "integer",
              "null"
            ],
            "description": "With qualifier_value, select counter occurrences whose element here\n(first component for EDIFACT) equals the qualifier exactly.",
            "minimum": 1
          },
          "qualifier_value": {
            "type": [
              "string",
              "null"
            ],
            "description": "Literal qualifier paired with qualifier_element, e.g. `2` for line totals.",
            "minLength": 1
          }
        }
      },
      "CredentialSource": {
        "type": "string",
        "description": "Where a credential came from, which decides how much the destination is\ntrusted. Platform credentials are operator-configured environment; tenant\ncredentials are customer input and get the public-address SSRF guard.",
        "enum": [
          "platform",
          "tenant"
        ]
      },
      "CustomsCategory": {
        "type": "string",
        "description": "The reason category a postal declaration must state.",
        "enum": [
          "gift",
          "commercial_sample",
          "returned_goods",
          "sale_of_goods",
          "documents",
          "other"
        ]
      },
      "CustomsLine": {
        "type": "object",
        "description": "One declared line on the commercial invoice.",
        "required": [
          "description",
          "quantity",
          "unit_price"
        ],
        "properties": {
          "country_of_origin": {
            "type": [
              "string",
              "null"
            ],
            "description": "ISO country of origin (where the goods were manufactured)."
          },
          "description": {
            "type": "string"
          },
          "hs_code": {
            "type": [
              "string",
              "null"
            ],
            "description": "Harmonized System tariff code (6\u201310 digits). Customs assesses duty by\nthis code, so it is required for a compliant declaration."
          },
          "net_weight_kg": {
            "type": [
              "string",
              "null"
            ],
            "description": "Net weight in kilograms for this line \u2014 required by postal customs\ndeclarations (CN22/CN23)."
          },
          "quantity": {
            "type": "string"
          },
          "sku": {
            "type": [
              "string",
              "null"
            ]
          },
          "unit_price": {
            "type": "string"
          },
          "uom": {
            "type": "string"
          }
        }
      },
      "CustomsLineMeta": {
        "type": "object",
        "properties": {
          "country_of_origin": {
            "type": [
              "string",
              "null"
            ]
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "hs_code": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "CustomsOverlay": {
        "type": "object",
        "description": "Customs metadata layered over an EDI invoice that the X12/EDIFACT payload\ndoesn't carry.",
        "properties": {
          "currency": {
            "type": "string"
          },
          "freight": {
            "type": [
              "string",
              "null"
            ]
          },
          "incoterms": {
            "type": [
              "string",
              "null"
            ]
          },
          "incoterms_place": {
            "type": [
              "string",
              "null"
            ]
          },
          "insurance": {
            "type": [
              "string",
              "null"
            ]
          },
          "lines": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CustomsLineMeta"
            },
            "description": "Per-line customs metadata, matched positionally to the invoice lines."
          },
          "reason_for_export": {
            "type": [
              "string",
              "null"
            ]
          },
          "ship_to": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/CustomsParty"
              },
              {
                "type": "null"
              }
            ]
          }
        }
      },
      "CustomsParty": {
        "type": "object",
        "description": "A party on the customs document (exporter, importer, or consignee).",
        "required": [
          "name"
        ],
        "properties": {
          "address_lines": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "city": {
            "type": [
              "string",
              "null"
            ]
          },
          "country": {
            "type": [
              "string",
              "null"
            ],
            "description": "ISO country code or name \u2014 required for the importer/exporter blocks."
          },
          "name": {
            "type": "string"
          },
          "postal_code": {
            "type": [
              "string",
              "null"
            ]
          },
          "state": {
            "type": [
              "string",
              "null"
            ]
          },
          "tax_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "Tax / EORI / VAT registration, when the destination requires it."
          }
        }
      },
      "CycleTime": {
        "type": "object",
        "description": "Document activity span across references that span multiple documents.",
        "required": [
          "metric",
          "references_measured"
        ],
        "properties": {
          "max_hours": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64"
          },
          "median_hours": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64"
          },
          "metric": {
            "type": "string",
            "description": "Stable metric name. This is not payment settlement or order-to-cash time."
          },
          "p95_hours": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64"
          },
          "references_measured": {
            "type": "integer",
            "description": "References with at least two documents (an order and a downstream doc).",
            "minimum": 0
          }
        }
      },
      "DayVolume": {
        "type": "object",
        "description": "Document count for one day.",
        "required": [
          "date",
          "count"
        ],
        "properties": {
          "count": {
            "type": "integer",
            "minimum": 0
          },
          "date": {
            "type": "string"
          }
        }
      },
      "Deduction": {
        "type": "object",
        "description": "A captured deduction and its dispute state.",
        "required": [
          "id",
          "tenant_id",
          "partner_id",
          "adjustment_number",
          "amount",
          "status",
          "history",
          "created_at",
          "updated_at"
        ],
        "properties": {
          "adjustment_number": {
            "type": "string",
            "description": "The 812 adjustment / chargeback number."
          },
          "amount": {
            "type": "string"
          },
          "category": {
            "type": [
              "string",
              "null"
            ],
            "description": "Operator-assigned root-cause category (e.g. `shortage`, `label`, `asn`)."
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "currency": {
            "type": "string"
          },
          "evidence": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/EvidenceNote"
            },
            "description": "Supporting evidence attached for the dispute."
          },
          "history": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DeductionEvent"
            }
          },
          "id": {
            "type": "string"
          },
          "invoice_number": {
            "type": [
              "string",
              "null"
            ]
          },
          "partner_id": {
            "type": "string"
          },
          "reason_codes": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "recovered_amount": {
            "type": [
              "string",
              "null"
            ],
            "description": "Amount recovered when disputed successfully (\u2264 `amount`)."
          },
          "status": {
            "$ref": "#/components/schemas/DeductionStatus"
          },
          "tenant_id": {
            "type": "string"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "DeductionCapture": {
        "type": "object",
        "description": "Fields needed to capture a new deduction.",
        "required": [
          "partner_id",
          "adjustment_number",
          "amount"
        ],
        "properties": {
          "adjustment_number": {
            "type": "string"
          },
          "amount": {
            "type": "string"
          },
          "category": {
            "type": [
              "string",
              "null"
            ]
          },
          "currency": {
            "type": [
              "string",
              "null"
            ]
          },
          "invoice_number": {
            "type": [
              "string",
              "null"
            ]
          },
          "partner_id": {
            "type": "string"
          },
          "reason_codes": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "DeductionEvent": {
        "type": "object",
        "description": "One entry in a deduction's audit trail.",
        "required": [
          "at",
          "actor",
          "action"
        ],
        "properties": {
          "action": {
            "type": "string"
          },
          "actor": {
            "type": "string"
          },
          "at": {
            "type": "string",
            "format": "date-time"
          },
          "note": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "DeductionStatus": {
        "type": "string",
        "description": "Lifecycle state of a deduction.",
        "enum": [
          "open",
          "disputed",
          "recovered",
          "denied",
          "written_off"
        ]
      },
      "DeductionSummary": {
        "type": "object",
        "description": "Roll-up of deduction exposure and recovery for a tenant.",
        "required": [
          "total",
          "open",
          "disputed",
          "recovered",
          "denied",
          "written_off",
          "at_risk_amount",
          "recovered_amount",
          "denied_amount",
          "by_category"
        ],
        "properties": {
          "at_risk_amount": {
            "type": "string",
            "description": "Sum of amounts not yet terminal \u2014 money still at risk."
          },
          "by_category": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CategoryRecovery"
            },
            "description": "Exposure and recovery broken out by root-cause category."
          },
          "denied": {
            "type": "integer",
            "minimum": 0
          },
          "denied_amount": {
            "type": "string",
            "description": "Sum of original amounts on lost (denied) disputes."
          },
          "disputed": {
            "type": "integer",
            "minimum": 0
          },
          "open": {
            "type": "integer",
            "minimum": 0
          },
          "recovered": {
            "type": "integer",
            "minimum": 0
          },
          "recovered_amount": {
            "type": "string",
            "description": "Sum of recovered amounts on recovered deductions."
          },
          "recovery_rate": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int32",
            "description": "Recovered \u00f7 (recovered + denied) by amount, percent 0\u2013100 \u2014 how well\ndisputes are converting. `None` until at least one dispute is resolved\nwith a monetary outcome.",
            "minimum": 0
          },
          "total": {
            "type": "integer",
            "minimum": 0
          },
          "written_off": {
            "type": "integer",
            "minimum": 0
          }
        }
      },
      "Delimiters": {
        "type": "object",
        "description": "The four delimiters that frame an X12 interchange. The element separator\nand segment terminator are dictated by the ISA segment itself; the\ncomponent separator is ISA16. The repetition separator (ISA11) only\nexists in 00501+ interchanges.",
        "required": [
          "element",
          "component",
          "segment"
        ],
        "properties": {
          "component": {
            "type": "string",
            "example": ">"
          },
          "element": {
            "type": "string",
            "example": "*"
          },
          "repetition": {
            "type": [
              "string",
              "null"
            ]
          },
          "segment": {
            "type": "string",
            "example": "~"
          }
        }
      },
      "DeliveryPageData": {
        "type": "object",
        "required": [
          "count",
          "deliveries"
        ],
        "properties": {
          "count": {
            "type": "integer",
            "description": "Rows returned in this page, before any client filtering.",
            "minimum": 0
          },
          "deliveries": {
            "type": "array",
            "items": {},
            "description": "Redacted delivery records; no original payload or captured wire bytes."
          }
        }
      },
      "DeliveryStatus": {
        "oneOf": [
          {
            "type": "object",
            "description": "No access point configured: the UBL is generated and validated but not\ntransmitted. This is the honest default \u2014 Peppol delivery requires a\ncertified access-point partner and the customer's jurisdiction.",
            "required": [
              "reason",
              "state"
            ],
            "properties": {
              "reason": {
                "type": "string"
              },
              "state": {
                "type": "string",
                "enum": [
                  "generation_only"
                ]
              }
            }
          }
        ],
        "description": "Where a generated e-invoice stands on delivery. The gateway generates and\nvalidates; transmission to a government / Peppol network is performed by a\ncertified access point, which is configured per deployment and jurisdiction."
      },
      "DeliveryView": {
        "type": "object",
        "required": [
          "event_id",
          "partner_id",
          "environment",
          "event_type",
          "reference",
          "status",
          "attempts",
          "receipt",
          "updated_at"
        ],
        "properties": {
          "attempts": {
            "type": "integer",
            "format": "int32"
          },
          "connection_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "environment": {
            "type": "string"
          },
          "event_id": {
            "type": "string"
          },
          "event_type": {
            "type": "string"
          },
          "last_error": {
            "type": [
              "string",
              "null"
            ]
          },
          "partner_id": {
            "type": "string"
          },
          "receipt": {
            "type": "object"
          },
          "reference": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "DiffEntry": {
        "type": "object",
        "description": "One field-level change between two guide versions.",
        "required": [
          "path",
          "change"
        ],
        "properties": {
          "after": {
            "type": "object"
          },
          "before": {
            "type": "object"
          },
          "change": {
            "type": "string",
            "description": "`added`, `removed`, or `changed`."
          },
          "path": {
            "type": "string",
            "description": "Dotted path, e.g. `validation.rules[0].mandatory`."
          }
        }
      },
      "DocumentDetail": {
        "type": "object",
        "description": "Drill-down audit detail for a processed document. The summary record is\nintentionally compact; this companion record keeps the heavier artifacts\noperators need during an EDI incident: raw wire, parsed/canonical data,\nsegment list, validation failure, and the generated acknowledgment.",
        "required": [
          "document",
          "raw"
        ],
        "properties": {
          "acknowledgment": {
            "type": [
              "string",
              "null"
            ],
            "description": "Generated 997 / TA1 / CONTRL acknowledgment for inbound documents."
          },
          "document": {
            "$ref": "#/components/schemas/DocumentRecord"
          },
          "parsed": {
            "description": "Canonical parsed payload returned by the transaction parser."
          },
          "raw": {
            "type": "string",
            "description": "Full raw interchange or outbound wire that produced this record."
          },
          "segments": {
            "type": "array",
            "items": {
              "type": "object"
            },
            "description": "X12 segment list when available. Empty for EDIFACT until message-level\nsegment rendering is promoted into the EDIFACT crate API."
          },
          "validation_error": {
            "type": [
              "string",
              "null"
            ],
            "description": "Partner-guide or parser failure when the document was rejected."
          },
          "validation_issues": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RejectionDetail"
            },
            "description": "Structured guide findings with 999-grade segment/element positions.\nAccepted inbound findings without a validation error remain advisory\nwarnings, including after persistence or partner-policy changes.\nSNIP levels and remediation details match the processing response."
          }
        }
      },
      "DocumentListEntry": {
        "allOf": [
          {
            "$ref": "#/components/schemas/DocumentRecord"
          },
          {
            "type": "object",
            "properties": {
              "validation_summary": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/DocumentValidationSummary"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            }
          }
        ],
        "description": "A document-list row keeps the record fields and adds compact stored evidence.\nAn omitted summary means no companion detail was available at the list read."
      },
      "DocumentRecord": {
        "type": "object",
        "description": "An entry in the processed-document log.",
        "required": [
          "id",
          "direction",
          "partner_id",
          "transaction_set",
          "control_number",
          "status",
          "reference",
          "processed_at"
        ],
        "properties": {
          "control_number": {
            "type": "string"
          },
          "correlation_id": {
            "type": "string",
            "description": "Ties this record to the request's logs (and, for outbound, its delivery).\nDefaulted for log lines written before correlation tracking existed."
          },
          "direction": {
            "type": "string",
            "description": "`inbound` or `outbound`."
          },
          "id": {
            "type": "string"
          },
          "partner_id": {
            "type": "string"
          },
          "processed_at": {
            "type": "string",
            "format": "date-time"
          },
          "reference": {
            "type": "string",
            "description": "Human-readable handle: PO number, shipment ID, invoice number."
          },
          "status": {
            "type": "string",
            "description": "`accepted`, `rejected`, `generated`, `queued`, or legacy `sent`."
          },
          "transaction_set": {
            "type": "string",
            "description": "Transaction set ID, e.g. `850`."
          }
        }
      },
      "DocumentValidation": {
        "type": "object",
        "required": [
          "transaction_set",
          "control_number",
          "accepted"
        ],
        "properties": {
          "accepted": {
            "type": "boolean"
          },
          "control_number": {
            "type": "string",
            "description": "X12 ST02 control number or EDIFACT UNH message reference."
          },
          "reason": {
            "type": [
              "string",
              "null"
            ]
          },
          "rejection": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "$ref": "#/components/schemas/RejectionDetail"
            },
            "description": "Structured guide findings, including advisory warnings on accepted\ntransactions/messages. Segment positions count ST or UNH as 1."
          },
          "transaction_set": {
            "type": "string",
            "description": "X12 ST01 transaction set ID or EDIFACT UNH message type."
          }
        }
      },
      "DocumentValidationSummary": {
        "type": "object",
        "description": "Historical validation evidence only; not current guide compliance, delivery,\nor business completion. Null counts mean the stored findings were malformed.",
        "required": [
          "validation_error"
        ],
        "properties": {
          "errors": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 0
          },
          "findings": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 0
          },
          "validation_error": {
            "type": "boolean"
          },
          "warnings": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 0
          }
        }
      },
      "EInvoiceParty": {
        "type": "object",
        "description": "A party on a Peppol invoice. `endpoint_id` + `endpoint_scheme` are the\nPeppol participant identifier (e.g. scheme `0088` GLN, `9930` DE:VAT) that\nrouting depends on; `vat_id` and `country` are BIS-mandatory.",
        "required": [
          "name"
        ],
        "properties": {
          "city": {
            "type": [
              "string",
              "null"
            ]
          },
          "country": {
            "type": [
              "string",
              "null"
            ],
            "description": "ISO 3166-1 alpha-2 country code (BIS-mandatory)."
          },
          "endpoint_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "Peppol participant ID (the value), e.g. a GLN or VAT number."
          },
          "endpoint_scheme": {
            "type": [
              "string",
              "null"
            ],
            "description": "Peppol electronic-address scheme (EAS code), e.g. `0088`, `9930`."
          },
          "name": {
            "type": "string"
          },
          "postal_code": {
            "type": [
              "string",
              "null"
            ]
          },
          "street": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "vat_id": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "EdiEvent": {
        "type": "object",
        "description": "One VES event, shaped for `POST /v1/ves/events/ingest` on the sequencer.",
        "required": [
          "event_id",
          "event_type",
          "entity_type",
          "entity_id",
          "occurred_at",
          "payload"
        ],
        "properties": {
          "entity_id": {
            "type": "string"
          },
          "entity_type": {
            "type": "string"
          },
          "event_id": {
            "type": "string"
          },
          "event_type": {
            "type": "string"
          },
          "occurred_at": {
            "type": "string",
            "format": "date-time"
          },
          "payload": {
            "type": "object"
          },
          "signature": {
            "type": [
              "string",
              "null"
            ],
            "description": "Ed25519 signature (hex) over the canonical event message. Absent when\nsigning is disabled. See [`crate::signing`]."
          }
        }
      },
      "EdifactDespatchAdvice": {
        "type": "object",
        "required": [
          "despatch_number",
          "lines"
        ],
        "properties": {
          "carrier": {
            "type": [
              "string",
              "null"
            ],
            "description": "TDT+20 carrier identification, when present."
          },
          "despatch_date": {
            "type": [
              "string",
              "null"
            ]
          },
          "despatch_number": {
            "type": "string"
          },
          "lines": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/EdifactDespatchLine"
            },
            "description": "Every despatch line once, with its despatched total, in order. A line\nsplit over several packages is one entry here."
          },
          "order_number": {
            "type": [
              "string",
              "null"
            ],
            "description": "RFF+ON referenced purchase-order number, when present."
          },
          "packages": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/EdifactDespatchPackage"
            },
            "description": "The SSCC-labelled packages and what each holds \u2014 see the module\ndocumentation for how both D.96A packaging forms map onto this and\nthe one form the builder writes. Every package has at least one\nSSCC; lines in no package are only in `lines`."
          },
          "ship_to": {
            "type": [
              "string",
              "null"
            ],
            "description": "Header-level NAD+DP (delivery party \u2014 EANCOM's ship-to) or, when no DP\nis sent, NAD+ST party id. The builder emits NAD+DP."
          }
        }
      },
      "EdifactDespatchLine": {
        "type": "object",
        "required": [
          "line_number",
          "item",
          "quantity"
        ],
        "properties": {
          "item": {
            "type": "string"
          },
          "line_number": {
            "type": "string"
          },
          "order_number": {
            "type": [
              "string",
              "null"
            ],
            "description": "SG16 RFF+ON under this LIN \u2014 the order this line ships against, for a\nconsolidated despatch covering several orders."
          },
          "quantity": {
            "type": "string",
            "description": "QTY+12 despatched quantity. On a package's line: the quantity in each\nSSCC of the package."
          },
          "quantity_unknown": {
            "type": "boolean",
            "description": "Only on a package's line: the message does not say how much of the\nline is in this package (a line in several SSCCs without SG20 QTY,\nor a package-level quantity that does not divide evenly over the\nlevel's SSCCs). `quantity` is then zero, so package contents never\nexceed what was despatched; the despatched total stays on the line in\n[`DespatchAdvice::lines`].\n\nOn a [`DespatchAdvice::lines`] entry: the message states no quantity\nfor the line at all (no LIN QTY and no SG20 QTY, in any repeat);\n`quantity` is then zero and the builder writes no QTY for it."
          }
        }
      },
      "EdifactDespatchPackage": {
        "type": "object",
        "description": "A group of identical SSCC-labelled packages (usually just one) and the\ncontents of each.",
        "required": [
          "sscc",
          "lines"
        ],
        "properties": {
          "additional_ssccs": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Further SSCCs of the group, in order \u2014 e.g. three identical cartons\n(`PAC+3++CT'\u2026GIN+BJ+S1+S2+S3'`). Each holds `lines`. Empty for a\nsingle package. See [`DespatchPackage::ssccs`]."
          },
          "lines": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/EdifactDespatchLine"
            },
            "description": "What each SSCC of the group holds: `quantity` is per SSCC."
          },
          "package_type": {
            "type": [
              "string",
              "null"
            ],
            "description": "PAC 7065 package type (e.g. `CT` carton, `201` pallet)."
          },
          "parent_sscc": {
            "type": [
              "string",
              "null"
            ],
            "description": "The SSCC of the package this group is packed in \u2014 e.g. a carton's\npallet \u2014 from the CPS 7166 parent packing level. Every SSCC of the\ngroup is in it. See the module documentation."
          },
          "sscc": {
            "type": "string",
            "description": "GIN+BJ \u2014 the group's (first) SSCC-18."
          }
        }
      },
      "EdifactInventoryLine": {
        "type": "object",
        "description": "One SG9 item line.",
        "required": [
          "line_number",
          "item",
          "quantities"
        ],
        "properties": {
          "item": {
            "type": "string",
            "description": "Item identifier from LIN C212 7140, else a PIA (5 outranks 1)."
          },
          "line_number": {
            "type": "string",
            "description": "LIN 1082 (n..6)."
          },
          "location": {
            "type": [
              "string",
              "null"
            ],
            "description": "SG9 LOC C517 3225 (an..25) \u2014 the item's location, when the line\nstates one before its quantities."
          },
          "quantities": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/EdifactInventoryQuantity"
            },
            "description": "SG11 quantities, in order."
          }
        }
      },
      "EdifactInventoryQuantity": {
        "type": "object",
        "description": "One SG11 quantity of an item.",
        "required": [
          "qualifier",
          "quantity"
        ],
        "properties": {
          "location": {
            "type": [
              "string",
              "null"
            ],
            "description": "SG11 LOC C517 3225 (an..25) \u2014 where this quantity is held."
          },
          "qualifier": {
            "type": "string",
            "description": "QTY C186 6063 quantity qualifier (`145` actual stock, `17` on hand,\n`198` in transit, \u2026)."
          },
          "quantity": {
            "type": "string",
            "description": "QTY C186 6060."
          },
          "uom": {
            "type": [
              "string",
              "null"
            ],
            "description": "QTY C186 6411 measure unit (e.g. `PCE`)."
          }
        }
      },
      "EdifactInventoryReport": {
        "type": "object",
        "description": "An inventory report.",
        "required": [
          "report_number",
          "lines"
        ],
        "properties": {
          "document_code": {
            "type": [
              "string",
              "null"
            ],
            "description": "BGM C002 1001 (`35` inventory report, `78` inventory movement\nadvice, `79` inventory status advice)."
          },
          "inventory_date": {
            "type": [
              "string",
              "null"
            ],
            "description": "Header DTM+366 \u2014 the date the inventory was reported for."
          },
          "lines": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/EdifactInventoryLine"
            }
          },
          "location": {
            "type": [
              "string",
              "null"
            ],
            "description": "SG2 LOC C517 3225 (an..25) under the reporting party \u2014 the reported\nlocation (written as LOC+18, warehouse)."
          },
          "message_function": {
            "type": [
              "string",
              "null"
            ],
            "description": "BGM 1225 message function (`9` original, `5` replace, \u2026)."
          },
          "report_date": {
            "type": [
              "string",
              "null"
            ],
            "description": "Header DTM+137 \u2014 the report's date."
          },
          "report_number": {
            "type": "string",
            "description": "BGM C106 1004 \u2014 the report's number."
          },
          "reporting_party": {
            "type": [
              "string",
              "null"
            ],
            "description": "SG2 NAD+GY \u2014 the inventory reporting party."
          }
        }
      },
      "EdifactInvoice": {
        "type": "object",
        "required": [
          "invoice_number",
          "lines"
        ],
        "properties": {
          "allowances": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/EdifactInvoiceAllowance"
            },
            "description": "Invoice-level allowances and charges (ALC + MOA): the header SG15\ngroups the summary does not total, then the summary SG51 totals (a\nsummary group supersedes header groups with the same indicator and\nservice code). The builder writes them in the summary."
          },
          "buyer": {
            "type": [
              "string",
              "null"
            ]
          },
          "currency": {
            "type": [
              "string",
              "null"
            ],
            "description": "CUX+2 \u2014 invoice currency (ISO 4217, e.g. `EUR`)."
          },
          "document_code": {
            "type": [
              "string",
              "null"
            ],
            "description": "BGM C002 document name code (380 commercial invoice, 381 credit note)."
          },
          "invoice_date": {
            "type": [
              "string",
              "null"
            ]
          },
          "invoice_number": {
            "type": "string"
          },
          "lines": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/EdifactInvoiceLine"
            }
          },
          "order_number": {
            "type": [
              "string",
              "null"
            ],
            "description": "SG1 RFF+ON at header level \u2014 the buyer's purchase order number."
          },
          "supplier": {
            "type": [
              "string",
              "null"
            ]
          },
          "tax_amount": {
            "type": [
              "string",
              "null"
            ],
            "description": "MOA+124 \u2014 the tax amount. Kept for compatibility with\n[`Invoice::taxes`]: the parser sets it to the *sum* of the summary tax\ngroups' amounts."
          },
          "tax_rate": {
            "type": [
              "string",
              "null"
            ],
            "description": "TAX+7 \u2014 the VAT rate in percent. Kept for compatibility with\n[`Invoice::taxes`]: the parser sets it to the *first* summary tax\ngroup's rate (or, with no summary TAX, the header SG6 TAX+7). A line's\nSG33 TAX goes to [`InvoiceLine::tax_rate`]; TAX inside an ALC group\n(SG21 / SG43) feeds neither."
          },
          "taxes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/EdifactInvoiceTax"
            },
            "description": "The summary tax breakdown (SG50 TAX-MOA), one entry per rate. When\nnon-empty the builder emits these and ignores `tax_rate`/`tax_amount`."
          },
          "total_amount": {
            "type": [
              "string",
              "null"
            ],
            "description": "MOA+86 / +9 message total amount payable, when present."
          }
        }
      },
      "EdifactInvoiceAllowance": {
        "type": "object",
        "description": "One invoice-level allowance (`A`) or charge (`C`): ALC followed by its\namount, MOA+8 (EANCOM's allowance or charge amount; also read: 131, 204\nallowance, 23 charge).",
        "required": [
          "indicator",
          "amount"
        ],
        "properties": {
          "amount": {
            "type": "string"
          },
          "code": {
            "type": [
              "string",
              "null"
            ],
            "description": "ALC 7161 special service code (e.g. `DI` discount, `FC` freight)."
          },
          "indicator": {
            "type": "string",
            "description": "ALC 5463: `A` allowance or `C` charge."
          }
        }
      },
      "EdifactInvoiceLine": {
        "type": "object",
        "required": [
          "line_number",
          "item",
          "quantity"
        ],
        "properties": {
          "allowances": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/EdifactInvoiceAllowance"
            },
            "description": "Line-level allowances and charges (SG38 ALC under this LIN + MOA)."
          },
          "amount": {
            "type": [
              "string",
              "null"
            ],
            "description": "MOA+203 line item amount, when present."
          },
          "item": {
            "type": "string",
            "description": "Item identifier (EAN/GTIN or supplier code) from the LIN segment."
          },
          "line_number": {
            "type": "string"
          },
          "price": {
            "type": [
              "string",
              "null"
            ],
            "description": "PRI+AAA unit price, when present."
          },
          "price_basis": {
            "type": [
              "string",
              "null"
            ],
            "description": "PRI C509 5284 unit price basis (`price` is per this many units, e.g.\n10); `None` means per 1."
          },
          "quantity": {
            "type": "string",
            "description": "QTY+47 invoiced quantity."
          },
          "tax_rate": {
            "type": [
              "string",
              "null"
            ],
            "description": "SG33 TAX+7 under this LIN \u2014 the line's VAT rate in percent, when the\nline states its own (TAX inside a line ALC group is not the line's)."
          }
        }
      },
      "EdifactInvoiceTax": {
        "type": "object",
        "description": "One summary tax group: TAX+7+<type>+++:::<rate>+<category> and its MOAs.",
        "properties": {
          "amount": {
            "type": [
              "string",
              "null"
            ],
            "description": "MOA+124 tax amount (or MOA+150 value added tax amount)."
          },
          "category": {
            "type": [
              "string",
              "null"
            ],
            "description": "TAX 5305 duty/tax/fee category (`S` standard, `AA` lower, `E` exempt\u2026)."
          },
          "rate": {
            "type": [
              "string",
              "null"
            ],
            "description": "TAX C243 5278 \u2014 the rate in percent."
          },
          "taxable_amount": {
            "type": [
              "string",
              "null"
            ],
            "description": "MOA+125 taxable amount \u2014 the base the rate applies to."
          }
        }
      },
      "ElementConstraint": {
        "type": "object",
        "description": "Constrains one positional element of a segment: it may be required and/or\nrestricted to an allowed value set. Because segment tags are specific to a\ntransaction set (PO1\u2192850, IT1\u2192810, ...), a constraint naturally applies\nonly where its segment occurs.",
        "required": [
          "segment",
          "element"
        ],
        "properties": {
          "allowed": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "If non-empty, the element must be one of these values."
          },
          "component": {
            "type": [
              "integer",
              "null"
            ],
            "description": "1-based component within an EDIFACT composite element, e.g. `2` for\nthe reference value in `RFF+ON:<value>` (element 1). Unset checks the\nelement itself: an X12 element, or an EDIFACT element's first\ncomponent. X12 elements have only component 1.",
            "minimum": 0
          },
          "element": {
            "type": "integer",
            "description": "1-based element position, e.g. `3` for the PO1 unit of measure.",
            "minimum": 0
          },
          "format": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/ElementFormat",
                "description": "Data-type format the element must match when present."
              },
              {
                "type": "null"
              }
            ]
          },
          "max_len": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Maximum length (in characters) when the element is present.",
            "minimum": 0
          },
          "min_len": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Minimum length (in characters) when the element is present.",
            "minimum": 0
          },
          "qualifier_element": {
            "type": [
              "integer",
              "null"
            ],
            "description": "With `qualifier_value`: apply only to occurrences whose element at\nthis position equals the qualifier (e.g. REF where REF01 = `DP`).",
            "minimum": 0
          },
          "qualifier_value": {
            "type": [
              "string",
              "null"
            ]
          },
          "required": {
            "type": "boolean",
            "description": "If true, the element must be present (non-empty)."
          },
          "segment": {
            "type": "string",
            "description": "Segment tag, e.g. `PO1`."
          },
          "sets": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Transaction sets the rule applies to (e.g. `[\"850\"]`); empty = every\nset containing the segment. Shared segments (REF, N1, DTM) mean\ndifferent things in different sets."
          }
        }
      },
      "ElementError": {
        "type": "object",
        "description": "One AK4/IK4 element error.",
        "required": [
          "position"
        ],
        "properties": {
          "code": {
            "type": [
              "string",
              "null"
            ],
            "description": "AK403 \u2014 element syntax error code."
          },
          "position": {
            "type": "string",
            "description": "AK401 \u2014 element position."
          },
          "value": {
            "type": [
              "string",
              "null"
            ],
            "description": "AK404 \u2014 copy of the bad data."
          }
        }
      },
      "ElementFormat": {
        "type": "string",
        "description": "X12 data-type formats an element can be pinned to. Deliberately the\nhigh-value subset: numeric identifiers, decimal amounts, and the CCYYMMDD /\nHHMM(SS) date-time shapes that reject the malformed values retailers\ncharge back over. Anything not listed validates as free text.",
        "enum": [
          "numeric",
          "decimal",
          "date",
          "time"
        ]
      },
      "ElementOverride": {
        "type": "object",
        "required": [
          "segment",
          "element",
          "value"
        ],
        "properties": {
          "element": {
            "type": "integer",
            "description": "1-based element position (element 1 is the first after the segment tag).",
            "minimum": 0
          },
          "segment": {
            "type": "string"
          },
          "transaction_set": {
            "type": [
              "string",
              "null"
            ]
          },
          "value": {
            "type": "string"
          }
        }
      },
      "ElementRef": {
        "type": "object",
        "description": "A (segment tag, 1-based element position) pair.",
        "required": [
          "segment",
          "element"
        ],
        "properties": {
          "element": {
            "type": "integer",
            "minimum": 0
          },
          "segment": {
            "type": "string"
          }
        }
      },
      "EligibilityInquiry270": {
        "type": "object",
        "required": [
          "trace_number",
          "inquiry_date",
          "payer_name",
          "payer_id",
          "provider_name",
          "provider_npi",
          "subscriber"
        ],
        "properties": {
          "inquiry_date": {
            "type": "string",
            "format": "date",
            "description": "BHT04 \u2014 inquiry date."
          },
          "payer_id": {
            "type": "string"
          },
          "payer_name": {
            "type": "string",
            "description": "2100A NM1*PR \u2014 payer name and id (PI)."
          },
          "provider_name": {
            "type": "string",
            "description": "2100B NM1*1P \u2014 provider name and NPI (XX)."
          },
          "provider_npi": {
            "type": "string"
          },
          "service_types": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "2110C EQ \u2014 service type codes (default `30`, health benefit plan coverage)."
          },
          "subscriber": {
            "$ref": "#/components/schemas/Subscriber",
            "description": "2100C NM1*IL + DMG \u2014 the subscriber whose eligibility we're checking."
          },
          "trace_number": {
            "type": "string",
            "description": "TRN02 \u2014 trace number tying the response back to this inquiry."
          }
        }
      },
      "ErpEvent": {
        "type": "object",
        "description": "A typed ERP/Sync event that drives an outbound order document.",
        "required": [
          "event_id",
          "type",
          "partner_id",
          "po_number"
        ],
        "properties": {
          "contract_version": {
            "type": [
              "string",
              "null"
            ],
            "description": "Select retail-v1: explicit dispatch/invoice facts, source identity,\nblocking compliance and atomic order-revision validation. Required for\nnew events when the partner sets require_retail_v1. Requires Postgres."
          },
          "data": {
            "type": "object",
            "description": "The overrides for the target set (see `Ack855Overrides`,\n`Asn856Overrides`, `Invoice810Overrides`)."
          },
          "event_id": {
            "type": "string",
            "description": "Caller-supplied unique id (1\u2013128 letters, digits or `-_.:`). A retry\nwith the same id returns the original document; a different payload\nunder the same id is a 409."
          },
          "partner_id": {
            "type": "string"
          },
          "po_number": {
            "type": "string"
          },
          "source_total_amount": {
            "type": [
              "string",
              "null"
            ],
            "description": "ERP invoice total, required by retail-v1 invoice.created and compared\nexactly with the generated 810 total (including supplied allowances)."
          },
          "type": {
            "type": "string",
            "description": "`order.acknowledged` (\u2192855), `fulfillment.created` (\u2192856) or\n`invoice.created` (\u2192810)."
          }
        },
        "additionalProperties": false
      },
      "Evidence": {
        "type": "object",
        "required": [
          "id",
          "tenant_id",
          "partner_id",
          "configuration_hash",
          "kind",
          "reference",
          "actor",
          "recorded_at",
          "details"
        ],
        "properties": {
          "actor": {
            "type": "string"
          },
          "configuration_hash": {
            "type": "string"
          },
          "details": {},
          "id": {
            "type": "string"
          },
          "kind": {
            "type": "string"
          },
          "partner_id": {
            "type": "string"
          },
          "recorded_at": {
            "type": "string",
            "format": "date-time"
          },
          "reference": {
            "type": "string"
          },
          "tenant_id": {
            "type": "string"
          }
        }
      },
      "EvidenceNote": {
        "type": "object",
        "description": "A piece of supporting evidence attached to a deduction \u2014 the chain of\ncustody a dispute is won on (a POD reference, a signed BOL link, a note).",
        "required": [
          "at",
          "actor",
          "note"
        ],
        "properties": {
          "actor": {
            "type": "string"
          },
          "at": {
            "type": "string",
            "format": "date-time"
          },
          "note": {
            "type": "string"
          },
          "url": {
            "type": [
              "string",
              "null"
            ],
            "description": "Link to the supporting artifact (an evidence-bundle export, a POD scan)."
          }
        }
      },
      "EvidenceStatus": {
        "type": "object",
        "description": "Eligibility against the captured configuration; not independent verification\nof an operator's partner or ERP acceptance attestation.",
        "required": [
          "id",
          "kind",
          "eligible",
          "exclusion_reason"
        ],
        "properties": {
          "eligible": {
            "type": "boolean"
          },
          "exclusion_reason": {
            "type": [
              "string",
              "null"
            ],
            "description": "Null for eligible evidence; otherwise why historical evidence is excluded."
          },
          "id": {
            "type": "string"
          },
          "kind": {
            "type": "string"
          }
        }
      },
      "EvidenceSubmission": {
        "type": "object",
        "required": [
          "kind",
          "reference"
        ],
        "properties": {
          "kind": {
            "type": "string"
          },
          "reference": {
            "type": "string"
          }
        }
      },
      "FtpsMailboxInput": {
        "type": "object",
        "required": [
          "host",
          "port",
          "user",
          "password",
          "inbound_dir",
          "outbound_dir"
        ],
        "properties": {
          "ca_pem": {
            "type": [
              "string",
              "null"
            ],
            "description": "Optional private CA trust anchor. Hostname verification remains mandatory."
          },
          "host": {
            "type": "string"
          },
          "implicit_tls": {
            "type": "boolean",
            "description": "Explicit AUTH TLS (false) or TLS from the first byte (true)."
          },
          "inbound_dir": {
            "type": "string"
          },
          "outbound_dir": {
            "type": "string"
          },
          "password": {
            "type": "string"
          },
          "port": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "user": {
            "type": "string"
          }
        },
        "additionalProperties": false
      },
      "FtpsMailboxState": {
        "type": "object",
        "required": [
          "paused"
        ],
        "properties": {
          "paused": {
            "type": "boolean"
          }
        },
        "additionalProperties": false
      },
      "FulfillmentEvent": {
        "type": "object",
        "description": "Canonical ERP fulfillment event: the fields an outbound 856 needs.\n\nOutput shape (serialized):\n\n```json\n{\n  \"type\": \"fulfillment.created\",\n  \"po_number\": \"PO-42\",\n  \"partner_id\": \"acme\",            // optional\n  \"shipment\": {\n    \"ship_date\": \"2026-09-27\",\n    \"carrier\": \"UPS\",              // optional, raw carrier name\n    \"carrier_scac\": \"UPSN\",        // optional\n    \"tracking_number\": \"1Z999...\", // optional\n    \"lines\": [{ \"sku\": \"SKU-1\", \"upc\": \"012345678905\", \"quantity\": 2 }]\n  }\n}\n```\n\nConsumed by `POST /v1/erp/events`, which turns it into an 856.",
        "required": [
          "type",
          "po_number",
          "shipment"
        ],
        "properties": {
          "partner_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "po_number": {
            "type": "string"
          },
          "shipment": {
            "$ref": "#/components/schemas/FulfillmentShipment"
          },
          "type": {
            "type": "string"
          }
        }
      },
      "FulfillmentLine": {
        "type": "object",
        "description": "One shipped line in a [`FulfillmentEvent`].",
        "required": [
          "sku",
          "quantity"
        ],
        "properties": {
          "quantity": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "sku": {
            "type": "string"
          },
          "upc": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "FulfillmentScorecard": {
        "type": "object",
        "description": "Program-level fulfillment health aggregated across all reconciled orders.",
        "required": [
          "orders",
          "orders_with_shipment",
          "total_ordered",
          "total_shipped",
          "total_warehouse_shipped",
          "perfect_orders",
          "variance_counts",
          "at_risk"
        ],
        "properties": {
          "at_risk": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AtRiskOrder"
            },
            "description": "Orders carrying chargeback risk, worst first."
          },
          "fill_rate": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int32",
            "description": "`min(shipped, ordered) / ordered` as a percent 0\u2013100 \u2014 the true fill\nrate (over-shipping doesn't inflate it; it shows up as a variance).",
            "minimum": 0
          },
          "orders": {
            "type": "integer",
            "description": "Orders with a purchase order.",
            "minimum": 0
          },
          "orders_with_shipment": {
            "type": "integer",
            "description": "Orders that also have a shipment notice or warehouse advice.",
            "minimum": 0
          },
          "perfect_order_rate": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int32",
            "description": "`perfect_orders / orders` percent.",
            "minimum": 0
          },
          "perfect_orders": {
            "type": "integer",
            "description": "Orders with zero variances.",
            "minimum": 0
          },
          "total_ordered": {
            "type": "string"
          },
          "total_shipped": {
            "type": "string"
          },
          "total_warehouse_shipped": {
            "type": "string"
          },
          "variance_counts": {
            "type": "object",
            "description": "Variance count by kind (`short_shipped`, `over_shipped`, \u2026).",
            "additionalProperties": {
              "type": "integer",
              "minimum": 0
            },
            "propertyNames": {
              "type": "string"
            }
          },
          "warehouse_fill_rate": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int32",
            "description": "`min(warehouse_shipped, ordered) / ordered` percent \u2014 3PL execution.",
            "minimum": 0
          }
        }
      },
      "FulfillmentShipment": {
        "type": "object",
        "description": "The shipment block of a [`FulfillmentEvent`].",
        "required": [
          "ship_date",
          "lines"
        ],
        "properties": {
          "carrier": {
            "type": [
              "string",
              "null"
            ],
            "description": "Carrier name exactly as the back end reported it."
          },
          "carrier_scac": {
            "type": [
              "string",
              "null"
            ]
          },
          "lines": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/FulfillmentLine"
            }
          },
          "ship_date": {
            "type": "string",
            "description": "`YYYY-MM-DD`, in the shop's own offset."
          },
          "tracking_number": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "GuideContent": {
        "type": "object",
        "required": [
          "validation",
          "overlay"
        ],
        "properties": {
          "overlay": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/PartnerOverlay"
              },
              {
                "type": "null"
              }
            ]
          },
          "validation": {
            "$ref": "#/components/schemas/PartnerValidation"
          }
        },
        "additionalProperties": false
      },
      "GuideDiff": {
        "type": "object",
        "description": "The diff between two guide versions.",
        "required": [
          "from_version",
          "to_version",
          "changes"
        ],
        "properties": {
          "changes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DiffEntry"
            }
          },
          "from_version": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "to_version": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          }
        }
      },
      "GuideDraft": {
        "type": "object",
        "required": [
          "revision",
          "validation",
          "publishing_available"
        ],
        "properties": {
          "overlay": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/PartnerOverlay"
              },
              {
                "type": "null"
              }
            ]
          },
          "publishing_available": {
            "type": "boolean",
            "description": "Atomic guide publication is available on PostgreSQL deployments."
          },
          "revision": {
            "type": "string",
            "description": "Opaque revision of the partner settings, including its environment."
          },
          "validation": {
            "$ref": "#/components/schemas/PartnerValidation"
          }
        }
      },
      "GuideIssue": {
        "type": "object",
        "description": "One problem found while validating a guide before publish.",
        "required": [
          "severity",
          "field",
          "message"
        ],
        "properties": {
          "field": {
            "type": "string"
          },
          "message": {
            "type": "string"
          },
          "severity": {
            "type": "string",
            "description": "`error` blocks publish; `warning` is advisory."
          }
        }
      },
      "GuidePublication": {
        "type": "object",
        "required": [
          "guide",
          "snapshot",
          "warnings"
        ],
        "properties": {
          "guide": {
            "$ref": "#/components/schemas/GuideDraft"
          },
          "snapshot": {
            "$ref": "#/components/schemas/GuideSnapshot"
          },
          "warnings": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/GuideIssue"
            }
          }
        }
      },
      "GuideResponse_GuideDraft": {
        "type": "object",
        "required": [
          "success",
          "data"
        ],
        "properties": {
          "data": {
            "type": "object",
            "required": [
              "revision",
              "validation",
              "publishing_available"
            ],
            "properties": {
              "overlay": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/PartnerOverlay"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "publishing_available": {
                "type": "boolean",
                "description": "Atomic guide publication is available on PostgreSQL deployments."
              },
              "revision": {
                "type": "string",
                "description": "Opaque revision of the partner settings, including its environment."
              },
              "validation": {
                "$ref": "#/components/schemas/PartnerValidation"
              }
            }
          },
          "success": {
            "type": "boolean"
          }
        }
      },
      "GuideResponse_GuidePublication": {
        "type": "object",
        "required": [
          "success",
          "data"
        ],
        "properties": {
          "data": {
            "type": "object",
            "required": [
              "guide",
              "snapshot",
              "warnings"
            ],
            "properties": {
              "guide": {
                "$ref": "#/components/schemas/GuideDraft"
              },
              "snapshot": {
                "$ref": "#/components/schemas/GuideSnapshot"
              },
              "warnings": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/GuideIssue"
                }
              }
            }
          },
          "success": {
            "type": "boolean"
          }
        }
      },
      "GuideResponse_GuideValidationReport": {
        "type": "object",
        "required": [
          "success",
          "data"
        ],
        "properties": {
          "data": {
            "type": "object",
            "required": [
              "valid",
              "issues"
            ],
            "properties": {
              "issues": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/GuideIssue"
                }
              },
              "valid": {
                "type": "boolean"
              }
            }
          },
          "success": {
            "type": "boolean"
          }
        }
      },
      "GuideRollback": {
        "type": "object",
        "required": [
          "expected_revision"
        ],
        "properties": {
          "expected_revision": {
            "type": "string"
          }
        },
        "additionalProperties": false
      },
      "GuideSnapshot": {
        "type": "object",
        "description": "An immutable snapshot of a partner's guide at a point in time.",
        "required": [
          "partner_id",
          "tenant_id",
          "version",
          "validation",
          "author",
          "created_at"
        ],
        "properties": {
          "author": {
            "type": "string",
            "description": "Who captured it (`admin`, `partner:{id}`)."
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "note": {
            "type": [
              "string",
              "null"
            ]
          },
          "overlay": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/PartnerOverlay"
              },
              {
                "type": "null"
              }
            ]
          },
          "partner_id": {
            "type": "string"
          },
          "tenant_id": {
            "type": "string"
          },
          "validation": {
            "$ref": "#/components/schemas/PartnerValidation"
          },
          "version": {
            "type": "integer",
            "format": "int32",
            "description": "Monotonic version, starting at 1.",
            "minimum": 0
          }
        }
      },
      "GuideUpdate": {
        "type": "object",
        "required": [
          "expected_revision",
          "validation",
          "overlay"
        ],
        "properties": {
          "expected_revision": {
            "type": "string"
          },
          "note": {
            "type": [
              "string",
              "null"
            ]
          },
          "overlay": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/PartnerOverlay",
                "description": "Full guide replacement: use explicit null to clear an existing overlay."
              },
              {
                "type": "null"
              }
            ]
          },
          "validation": {
            "$ref": "#/components/schemas/PartnerValidation"
          }
        },
        "additionalProperties": false
      },
      "GuideValidationReport": {
        "type": "object",
        "required": [
          "valid",
          "issues"
        ],
        "properties": {
          "issues": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/GuideIssue"
            }
          },
          "valid": {
            "type": "boolean"
          }
        }
      },
      "HostedSftpMailboxInput": {
        "type": "object",
        "required": [
          "public_keys",
          "enabled",
          "quota_bytes",
          "max_file_bytes",
          "max_files"
        ],
        "properties": {
          "enabled": {
            "type": "boolean"
          },
          "max_file_bytes": {
            "type": "integer",
            "format": "int64"
          },
          "max_files": {
            "type": "integer",
            "format": "int32"
          },
          "public_keys": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Complete OpenSSH public keys; never private keys or authorized_keys options."
          },
          "quota_bytes": {
            "type": "integer",
            "format": "int64"
          },
          "route_outbound_documents": {
            "type": "boolean",
            "description": "Use this mailbox as the primary route for new outbound business documents.\nSuspension blocks partner access but preserves queued outbound documents."
          }
        },
        "additionalProperties": false
      },
      "HostedSftpMailboxState": {
        "type": "object",
        "required": [
          "enabled"
        ],
        "properties": {
          "enabled": {
            "type": "boolean"
          }
        },
        "additionalProperties": false
      },
      "ImportSummary": {
        "type": "object",
        "description": "Outcome of a bulk import.",
        "required": [
          "rows",
          "created",
          "updated",
          "removed",
          "total"
        ],
        "properties": {
          "created": {
            "type": "integer",
            "minimum": 0
          },
          "removed": {
            "type": "integer",
            "description": "Rows removed because the import ran in `replace` mode.",
            "minimum": 0
          },
          "rows": {
            "type": "integer",
            "minimum": 0
          },
          "total": {
            "type": "integer",
            "minimum": 0
          },
          "updated": {
            "type": "integer",
            "minimum": 0
          }
        }
      },
      "InboundDocument": {
        "type": "object",
        "required": [
          "transaction_set",
          "control_number",
          "status",
          "reference"
        ],
        "properties": {
          "control_number": {
            "type": "string"
          },
          "document_id": {
            "type": "string",
            "description": "The processed-document id (`GET /v1/documents/{id}`) recorded for this\ntransaction set. Empty on receipts stored before it was tracked."
          },
          "error": {
            "type": [
              "string",
              "null"
            ]
          },
          "parsed": {
            "type": [
              "object",
              "null"
            ]
          },
          "reference": {
            "type": "string"
          },
          "rejection": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "$ref": "#/components/schemas/RejectionDetail"
            },
            "description": "Structured, SNIP-classified guide findings: fatal errors on rejected\ntransactions and advisory warnings on accepted transactions. The same\nfindings the 999 reports, surfaced for operators and agents."
          },
          "status": {
            "type": "string"
          },
          "transaction_set": {
            "type": "string"
          }
        }
      },
      "InboundResult": {
        "type": "object",
        "required": [
          "partner_id",
          "interchange_control_number",
          "status",
          "documents",
          "events_queued"
        ],
        "properties": {
          "ack_997": {
            "type": [
              "string",
              "null"
            ],
            "description": "Serialized 997 interchange acknowledging what we received. `None` when\nthe inbound interchange only contained FA groups or was rejected."
          },
          "ack_contrl": {
            "type": [
              "string",
              "null"
            ],
            "description": "Serialized EDIFACT CONTRL acknowledgment, for inbound EDIFACT interchanges."
          },
          "ack_ta1": {
            "type": [
              "string",
              "null"
            ],
            "description": "Serialized TA1 interchange rejection, when envelope validation failed."
          },
          "documents": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InboundDocument"
            }
          },
          "error": {
            "type": [
              "string",
              "null"
            ]
          },
          "events_queued": {
            "type": "integer",
            "minimum": 0
          },
          "interchange_acknowledgments": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InterchangeAcknowledgment"
            },
            "description": "Interchange-level TA1 acknowledgments received, not generated replies."
          },
          "interchange_control_number": {
            "type": "string"
          },
          "partner_id": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "description": "`processed` or `interchange_rejected`."
          }
        }
      },
      "IngestSummary": {
        "type": "object",
        "description": "Summary of an 832 ingest.",
        "required": [
          "items",
          "created",
          "updated",
          "unchanged",
          "skipped"
        ],
        "properties": {
          "created": {
            "type": "integer",
            "minimum": 0
          },
          "items": {
            "type": "integer",
            "minimum": 0
          },
          "skipped": {
            "type": "integer",
            "minimum": 0
          },
          "unchanged": {
            "type": "integer",
            "minimum": 0
          },
          "updated": {
            "type": "integer",
            "minimum": 0
          }
        }
      },
      "InterchangeAcknowledgment": {
        "type": "object",
        "required": [
          "control_number",
          "date",
          "time",
          "acknowledgment_code",
          "note_code"
        ],
        "properties": {
          "acknowledgment_code": {
            "type": "string"
          },
          "control_number": {
            "type": "string"
          },
          "date": {
            "type": "string"
          },
          "note_code": {
            "type": "string"
          },
          "time": {
            "type": "string"
          }
        }
      },
      "InventoryAdvice846": {
        "type": "object",
        "required": [
          "purpose",
          "report_type",
          "reference_id",
          "items"
        ],
        "properties": {
          "date": {
            "type": [
              "string",
              "null"
            ],
            "format": "date",
            "description": "BIA04."
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InventoryItem"
            }
          },
          "parties": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Party"
            }
          },
          "purpose": {
            "type": "string",
            "description": "BIA01 \u2014 transaction set purpose (00 original, 05 replace, ...)."
          },
          "reference_id": {
            "type": "string",
            "description": "BIA03 \u2014 the sender's reference identification for this report."
          },
          "report_type": {
            "type": "string",
            "description": "BIA02 \u2014 report type code (e.g. `PQ` product activity, `SI` current\nsummary inventory)."
          }
        }
      },
      "InventoryItem": {
        "type": "object",
        "required": [
          "ids",
          "quantities"
        ],
        "properties": {
          "description": {
            "type": [
              "string",
              "null"
            ],
            "description": "PID05 of the F-format description, when present."
          },
          "ids": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ProductId"
            },
            "description": "LIN02+ qualifier/value identifier pairs (UP UPC, SK seller SKU, ...)."
          },
          "line_number": {
            "type": [
              "string",
              "null"
            ],
            "description": "LIN01 \u2014 assigned line number (optional in the spec)."
          },
          "quantities": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InventoryQuantity"
            },
            "description": "QTY segments for this item, one per reported quantity kind."
          }
        }
      },
      "InventoryQuantity": {
        "type": "object",
        "required": [
          "qualifier",
          "quantity"
        ],
        "properties": {
          "qualifier": {
            "type": "string",
            "description": "QTY01 quantity qualifier: `33` available, `17` on-hand/quantity\nreceived, `20` damaged, `83` backorder, `99` quantity remaining, ..."
          },
          "quantity": {
            "type": "string",
            "description": "QTY02."
          },
          "uom": {
            "type": [
              "string",
              "null"
            ],
            "description": "QTY03 \u2014 composite unit of measure (first component is the UOM code)."
          }
        }
      },
      "Invoice810": {
        "type": "object",
        "required": [
          "invoice_number",
          "invoice_date",
          "po_number",
          "lines",
          "total_amount"
        ],
        "properties": {
          "allowances": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Allowance"
            },
            "description": "Header-level allowances and charges (SAC) \u2014 freight, discounts, handling,\npromotional allowances. Retailers chargeback when these don't reconcile,\nso they are first-class, not folded silently into the unit price."
          },
          "invoice_date": {
            "type": "string",
            "format": "date",
            "description": "BIG01."
          },
          "invoice_number": {
            "type": "string",
            "description": "BIG02."
          },
          "lines": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceLine"
            }
          },
          "po_number": {
            "type": "string",
            "description": "BIG04 \u2014 the PO being invoiced."
          },
          "terms_discount_days": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int32",
            "minimum": 0
          },
          "terms_discount_percent": {
            "type": [
              "string",
              "null"
            ]
          },
          "terms_net_days": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int32",
            "description": "ITD payment terms, e.g. net days.",
            "minimum": 0
          },
          "total_amount": {
            "type": "string",
            "description": "Total invoice amount in the partner's currency. Serialized into TDS\nwith implied two decimals, per spec."
          },
          "transaction_type": {
            "type": [
              "string",
              "null"
            ],
            "description": "BIG07 transaction type code: `CR` sends a credit memo, `DR` a debit\nmemo; absent is an ordinary invoice."
          }
        }
      },
      "Invoice810Overrides": {
        "type": "object",
        "description": "810 overrides. With `lines`, the invoice bills exactly those lines (a line\nwithout `quantity` bills its remaining quantity; `unit_price` defaults to\nthe PO price). The total is always recomputed.",
        "properties": {
          "allowances": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "$ref": "#/components/schemas/Allowance"
            }
          },
          "invoice_date": {
            "type": [
              "string",
              "null"
            ],
            "format": "date"
          },
          "invoice_number": {
            "type": [
              "string",
              "null"
            ]
          },
          "lines": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceLineOverride"
            }
          },
          "terms_discount_days": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int32",
            "minimum": 0
          },
          "terms_discount_percent": {
            "type": [
              "string",
              "null"
            ]
          },
          "terms_net_days": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int32",
            "minimum": 0
          }
        },
        "additionalProperties": false
      },
      "InvoiceIn810": {
        "type": "object",
        "description": "Parsed inbound 810.",
        "required": [
          "invoice_number",
          "lines"
        ],
        "properties": {
          "allowances": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Allowance"
            },
            "description": "Header-level allowances/charges (SAC) on the supplier's invoice."
          },
          "invoice_date": {
            "type": [
              "string",
              "null"
            ],
            "format": "date",
            "description": "BIG01."
          },
          "invoice_number": {
            "type": "string",
            "description": "BIG02."
          },
          "lines": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceLineIn"
            }
          },
          "po_number": {
            "type": [
              "string",
              "null"
            ],
            "description": "BIG04 \u2014 the PO this invoice bills against."
          },
          "total_amount": {
            "type": [
              "string",
              "null"
            ],
            "description": "TDS01 total, restored from its implied-two-decimal wire form."
          },
          "transaction_type": {
            "type": [
              "string",
              "null"
            ],
            "description": "BIG07 transaction type code (`CR` = credit memo, `DR` = debit memo)."
          }
        }
      },
      "InvoiceLine": {
        "type": "object",
        "required": [
          "quantity",
          "unit_price"
        ],
        "properties": {
          "ids": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ProductId"
            }
          },
          "line_number": {
            "type": [
              "string",
              "null"
            ]
          },
          "quantity": {
            "type": "string"
          },
          "unit_price": {
            "type": "string"
          },
          "uom": {
            "type": "string"
          }
        }
      },
      "InvoiceLineIn": {
        "type": "object",
        "properties": {
          "allowances": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Allowance"
            },
            "description": "SAC allowances/charges inside this line's IT1 loop."
          },
          "ids": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ProductId"
            }
          },
          "line_number": {
            "type": [
              "string",
              "null"
            ]
          },
          "quantity": {
            "type": [
              "string",
              "null"
            ]
          },
          "unit_price": {
            "type": [
              "string",
              "null"
            ]
          },
          "uom": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "InvoiceLineOverride": {
        "type": "object",
        "required": [
          "line_number"
        ],
        "properties": {
          "line_number": {
            "type": "string"
          },
          "quantity": {
            "type": [
              "string",
              "null"
            ]
          },
          "unit_price": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "additionalProperties": false
      },
      "IssueSeverity": {
        "type": "string",
        "enum": [
          "error",
          "warning"
        ]
      },
      "ItemXref": {
        "type": "object",
        "description": "One item cross-reference.",
        "required": [
          "id",
          "tenant_id",
          "partner_id",
          "sku",
          "created_at",
          "updated_at"
        ],
        "properties": {
          "buyer_part": {
            "type": [
              "string",
              "null"
            ],
            "description": "Buyer part number; matches BP/IN/PI ids."
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "id": {
            "type": "string"
          },
          "pack_size": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int32",
            "description": "Eaches per partner unit.",
            "minimum": 0
          },
          "partner_id": {
            "type": "string"
          },
          "partner_item_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "The partner's item identifier; matches any inbound qualifier."
          },
          "sku": {
            "type": "string",
            "description": "Our SKU."
          },
          "tenant_id": {
            "type": "string"
          },
          "uom": {
            "type": [
              "string",
              "null"
            ],
            "description": "X12 unit-of-measure code the partner orders in (e.g. `CA`)."
          },
          "upc": {
            "type": [
              "string",
              "null"
            ],
            "description": "UPC / EAN / GTIN (digits); matches UP/UK/UA/EN/UI ids, ignoring\nleading zeros."
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "ItemXrefInput": {
        "type": "object",
        "description": "Create/update body for an item cross-reference.",
        "required": [
          "sku"
        ],
        "properties": {
          "buyer_part": {
            "type": [
              "string",
              "null"
            ]
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "pack_size": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int32",
            "minimum": 0
          },
          "partner_item_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "sku": {
            "type": "string"
          },
          "uom": {
            "type": [
              "string",
              "null"
            ]
          },
          "upc": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "additionalProperties": false
      },
      "KeyRevocation": {
        "type": "object",
        "required": [
          "fingerprint"
        ],
        "properties": {
          "fingerprint": {
            "type": "string"
          }
        },
        "additionalProperties": false
      },
      "LabelProfile": {
        "type": "object",
        "description": "Per-partner label **placement profile** \u2014 the label facet of a partner\ncompanion guide. Controls the physical label (print width, length, darkness)\nand an optional partner-required mark. Defaults to a 4\u00d76\" thermal label at\n203 dpi.",
        "properties": {
          "darkness": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int32",
            "description": "Print darkness (ZPL `^MD`, 0\u201330); `None` leaves the printer default.",
            "minimum": 0
          },
          "height_dots": {
            "type": "integer",
            "format": "int32",
            "description": "Label length in dots (ZPL `^LL`). 1218 = 6\" at 203 dpi.",
            "minimum": 0
          },
          "partner_mark": {
            "type": [
              "string",
              "null"
            ],
            "description": "A partner-required mark printed at the label's top edge (e.g. a routing or\ndepartment code the retailer mandates)."
          },
          "width_dots": {
            "type": "integer",
            "format": "int32",
            "description": "Print width in dots (ZPL `^PW`). 812 = 4\" at 203 dpi.",
            "minimum": 0
          }
        }
      },
      "Lead": {
        "type": "object",
        "description": "A captured sales lead.",
        "required": [
          "id",
          "email",
          "created_at"
        ],
        "properties": {
          "company": {
            "type": "string"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "email": {
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "note": {
            "type": "string"
          },
          "retailer": {
            "type": "string",
            "description": "The retailer guide they were checking against, when known."
          },
          "sample_excerpt": {
            "type": "string",
            "description": "A truncated excerpt of the file they checked, for sales context."
          },
          "source": {
            "type": "string",
            "description": "Where the lead came from: `checker`, `landing`, \u2026"
          }
        }
      },
      "LibrarySummary": {
        "type": "object",
        "description": "Roll-up of the shared library \u2014 the network-effect dashboard.",
        "required": [
          "templates",
          "certified",
          "total_reuse"
        ],
        "properties": {
          "certified": {
            "type": "integer",
            "minimum": 0
          },
          "templates": {
            "type": "integer",
            "minimum": 0
          },
          "total_reuse": {
            "type": "integer",
            "format": "int32",
            "description": "Total inheritances across all templates.",
            "minimum": 0
          }
        }
      },
      "LineAdjustment": {
        "type": "object",
        "description": "One CDD line adjustment.",
        "required": [
          "reason_code"
        ],
        "properties": {
          "amount": {
            "type": [
              "string",
              "null"
            ],
            "description": "CDD04 \u2014 adjustment amount."
          },
          "credit_debit_flag": {
            "type": [
              "string",
              "null"
            ],
            "description": "CDD02 \u2014 credit/debit flag."
          },
          "reason_code": {
            "type": "string",
            "description": "CDD01 \u2014 adjustment reason code."
          }
        }
      },
      "LineQuantity": {
        "type": "object",
        "required": [
          "line_number",
          "quantity"
        ],
        "properties": {
          "line_number": {
            "type": "string"
          },
          "quantity": {
            "type": "string"
          }
        },
        "additionalProperties": false
      },
      "LocationXref": {
        "type": "object",
        "description": "One location cross-reference.",
        "required": [
          "id",
          "tenant_id",
          "partner_id",
          "partner_location_id",
          "location_id",
          "created_at",
          "updated_at"
        ],
        "properties": {
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "id": {
            "type": "string"
          },
          "location_id": {
            "type": "string",
            "description": "Our location / warehouse id."
          },
          "location_type": {
            "type": [
              "string",
              "null"
            ],
            "description": "`store`, `dc`, \u2026 (free text, informational)."
          },
          "partner_id": {
            "type": "string"
          },
          "partner_location_id": {
            "type": "string",
            "description": "The partner's store / DC number (N1*ST/N104). Numeric values match\nregardless of leading zeros."
          },
          "ship_to": {
            "type": [
              "string",
              "null"
            ],
            "description": "Our ship-to code, if it differs from the location id."
          },
          "tenant_id": {
            "type": "string"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "LocationXrefInput": {
        "type": "object",
        "description": "Create/update body for a location cross-reference.",
        "required": [
          "partner_location_id",
          "location_id"
        ],
        "properties": {
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "location_id": {
            "type": "string"
          },
          "location_type": {
            "type": [
              "string",
              "null"
            ]
          },
          "partner_location_id": {
            "type": "string"
          },
          "ship_to": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "additionalProperties": false
      },
      "MailConnectionInput": {
        "type": "object",
        "required": [
          "environment",
          "service_url",
          "api_key",
          "sender"
        ],
        "properties": {
          "api_key": {
            "type": "string",
            "description": "A Mail tenant key. Platform-wide keys are rejected."
          },
          "environment": {
            "type": "string"
          },
          "sender": {
            "type": "string",
            "description": "An active mailbox owned by the credential's Mail tenant."
          },
          "service_url": {
            "type": "string",
            "description": "HTTPS origin of a StateSet Mail-compatible service."
          }
        },
        "additionalProperties": false
      },
      "MailConnectionResponse": {
        "type": "object",
        "required": [
          "success",
          "data"
        ],
        "properties": {
          "data": {
            "$ref": "#/components/schemas/MailConnectionView"
          },
          "success": {
            "type": "boolean"
          }
        }
      },
      "MailConnectionState": {
        "type": "object",
        "required": [
          "paused"
        ],
        "properties": {
          "paused": {
            "type": "boolean"
          }
        },
        "additionalProperties": false
      },
      "MailConnectionView": {
        "type": "object",
        "required": [
          "id",
          "environment",
          "mode",
          "service_url",
          "mail_tenant_id",
          "mailbox_id",
          "sender",
          "active",
          "paused",
          "tested_at",
          "pending_deliveries"
        ],
        "properties": {
          "active": {
            "type": "boolean"
          },
          "environment": {
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "mail_tenant_id": {
            "type": "string"
          },
          "mailbox_id": {
            "type": "string"
          },
          "mode": {
            "type": "string"
          },
          "paused": {
            "type": "boolean"
          },
          "pending_deliveries": {
            "type": "integer",
            "format": "int64"
          },
          "sender": {
            "type": "string"
          },
          "service_url": {
            "type": "string"
          },
          "tested_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "MailConnectionsData": {
        "type": "object",
        "required": [
          "available",
          "managed_available",
          "connections"
        ],
        "properties": {
          "available": {
            "type": "boolean"
          },
          "connections": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MailConnectionView"
            }
          },
          "managed_available": {
            "type": "boolean"
          }
        }
      },
      "MailConnectionsResponse": {
        "type": "object",
        "required": [
          "success",
          "data"
        ],
        "properties": {
          "data": {
            "$ref": "#/components/schemas/MailConnectionsData"
          },
          "success": {
            "type": "boolean"
          }
        }
      },
      "MailDeliveryPage": {
        "type": "object",
        "required": [
          "count",
          "deliveries"
        ],
        "properties": {
          "count": {
            "type": "integer",
            "minimum": 0
          },
          "deliveries": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MailDeliveryView"
            }
          }
        }
      },
      "MailDeliveryResponse": {
        "type": "object",
        "required": [
          "success",
          "data"
        ],
        "properties": {
          "data": {
            "$ref": "#/components/schemas/MailDeliveryPage"
          },
          "success": {
            "type": "boolean"
          }
        }
      },
      "MailDeliveryView": {
        "type": "object",
        "required": [
          "id",
          "partner_id",
          "transaction_set",
          "control_number",
          "reference",
          "status",
          "attempts",
          "next_attempt_at",
          "created_at",
          "updated_at"
        ],
        "properties": {
          "attempts": {
            "type": "integer",
            "format": "int32"
          },
          "connection_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "control_number": {
            "type": "string"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "document_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "id": {
            "type": "string"
          },
          "last_error": {
            "type": [
              "string",
              "null"
            ]
          },
          "mail_receipt": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/MailReceipt"
              },
              {
                "type": "null"
              }
            ]
          },
          "next_attempt_at": {
            "type": "string",
            "format": "date-time"
          },
          "partner_id": {
            "type": "string"
          },
          "reference": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "description": "accepted means Mail queue acceptance; legacy_accepted has no durable receipt."
          },
          "transaction_set": {
            "type": "string"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "MailProvisioningResponse": {
        "type": "object",
        "required": [
          "success",
          "data"
        ],
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MailProvisioningView"
            }
          },
          "success": {
            "type": "boolean"
          }
        }
      },
      "MailProvisioningView": {
        "type": "object",
        "required": [
          "id",
          "environment",
          "address",
          "status",
          "created_at",
          "updated_at"
        ],
        "properties": {
          "address": {
            "type": "string"
          },
          "connection_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "environment": {
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "MailReceipt": {
        "type": "object",
        "required": [
          "id",
          "status",
          "accepted_at"
        ],
        "properties": {
          "accepted_at": {
            "type": "string",
            "format": "date-time"
          },
          "id": {
            "type": "string"
          },
          "message_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "$ref": "#/components/schemas/MailStatus"
          }
        }
      },
      "MailStatus": {
        "type": "string",
        "description": "State of the Mail service's own queue, not an EDI acknowledgment.",
        "enum": [
          "queued",
          "pending",
          "sending",
          "sent",
          "failed",
          "bounced",
          "suppressed"
        ]
      },
      "MailboxInput": {
        "type": "object",
        "required": [
          "host",
          "port",
          "user",
          "host_key",
          "inbound_dir",
          "outbound_dir"
        ],
        "properties": {
          "host": {
            "type": "string"
          },
          "host_key": {
            "type": "string"
          },
          "inbound_dir": {
            "type": "string"
          },
          "mailbox_policy": {
            "$ref": "#/components/schemas/MailboxPolicy"
          },
          "outbound_dir": {
            "type": "string"
          },
          "password": {
            "type": [
              "string",
              "null"
            ]
          },
          "port": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "private_key_pem": {
            "type": [
              "string",
              "null"
            ]
          },
          "user": {
            "type": "string"
          }
        },
        "additionalProperties": false
      },
      "MailboxPolicy": {
        "type": "object",
        "properties": {
          "delete_after_ack": {
            "type": "boolean",
            "description": "Delete only after durable processing and successful acknowledgment publication.\nInvalid or uncertain files remain on the server for operator review.",
            "default": false
          },
          "inbound_prefixes": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Empty uses .edi/.x12/.txt; otherwise only these case-sensitive prefixes.",
            "default": []
          },
          "outbound_prefixes": {
            "type": "object",
            "description": "Agreed document codes, keyed by X12 set (including 997/999/TA1).\nWhen nonempty, a missing code fails acceptance instead of inventing a name.",
            "default": {},
            "additionalProperties": {
              "type": "string"
            },
            "propertyNames": {
              "type": "string"
            }
          },
          "poll_interval_seconds": {
            "type": "integer",
            "format": "int32",
            "default": 10,
            "minimum": 0
          }
        },
        "additionalProperties": false
      },
      "MailboxState": {
        "type": "object",
        "required": [
          "paused"
        ],
        "properties": {
          "paused": {
            "type": "boolean"
          }
        },
        "additionalProperties": false
      },
      "ManagedMailInput": {
        "type": "object",
        "required": [
          "environment"
        ],
        "properties": {
          "environment": {
            "type": "string"
          },
          "replace_connection_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "Explicitly replace this current revision if configuration changed while\nan earlier provisioning attempt was pending. Omit for ordinary retries."
          }
        },
        "additionalProperties": false
      },
      "ManifestIssue": {
        "type": "object",
        "description": "An issue found while validating a manifest.",
        "required": [
          "severity",
          "field",
          "message"
        ],
        "properties": {
          "field": {
            "type": "string"
          },
          "message": {
            "type": "string"
          },
          "severity": {
            "type": "string",
            "description": "`error` blocks certification; `warning` is advisory."
          }
        }
      },
      "MappingArray": {
        "type": "object",
        "required": [
          "target",
          "source",
          "item"
        ],
        "properties": {
          "item": {
            "$ref": "#/components/schemas/MappingDefinition"
          },
          "source": {
            "type": "string"
          },
          "target": {
            "type": "string"
          }
        },
        "additionalProperties": false
      },
      "MappingDefinition": {
        "type": "object",
        "required": [
          "fields"
        ],
        "properties": {
          "arrays": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MappingArray"
            }
          },
          "fields": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MappingField"
            }
          }
        },
        "additionalProperties": false
      },
      "MappingField": {
        "type": "object",
        "required": [
          "target",
          "source"
        ],
        "properties": {
          "default": {},
          "factor": {
            "type": [
              "string",
              "null"
            ],
            "description": "Exact multiplication for unit conversion; input must be a string."
          },
          "lookup": {
            "type": "object",
            "additionalProperties": {},
            "propertyNames": {
              "type": "string"
            }
          },
          "required": {
            "type": "boolean"
          },
          "source": {
            "type": "string",
            "description": "RFC 6901 JSON pointer, relative to this object/array row."
          },
          "target": {
            "type": "string"
          }
        },
        "additionalProperties": false
      },
      "MappingFixture": {
        "type": "object",
        "required": [
          "name",
          "input"
        ],
        "properties": {
          "error_contains": {
            "type": [
              "string",
              "null"
            ]
          },
          "expected": {},
          "input": {},
          "name": {
            "type": "string"
          }
        },
        "additionalProperties": false
      },
      "MappingPreview": {
        "type": "object",
        "required": [
          "definition",
          "input"
        ],
        "properties": {
          "definition": {
            "$ref": "#/components/schemas/MappingDefinition"
          },
          "input": {}
        },
        "additionalProperties": false
      },
      "MappingPublish": {
        "type": "object",
        "required": [
          "expected_version",
          "definition",
          "fixtures",
          "note"
        ],
        "properties": {
          "definition": {
            "$ref": "#/components/schemas/MappingDefinition"
          },
          "expected_version": {
            "type": "integer",
            "format": "int64"
          },
          "fixtures": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MappingFixture"
            }
          },
          "note": {
            "type": "string"
          }
        },
        "additionalProperties": false
      },
      "MdnCallbackSummary": {
        "type": "object",
        "description": "Operational callback metadata. Original receipt bytes, callback URLs,\nsigning/configuration material, and worker leases are excluded.",
        "required": [
          "id",
          "tenant_id",
          "partner_id",
          "original_message_id",
          "message_id",
          "accepted",
          "status",
          "attempts",
          "next_attempt_at",
          "created_at"
        ],
        "properties": {
          "accepted": {
            "type": "boolean",
            "description": "Server-recorded inbound acceptance, independent of callback delivery status."
          },
          "attempts": {
            "type": "integer",
            "format": "int32"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "delivered_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "id": {
            "type": "string"
          },
          "last_error": {
            "type": [
              "string",
              "null"
            ]
          },
          "message_id": {
            "type": "string"
          },
          "next_attempt_at": {
            "type": "string",
            "format": "date-time"
          },
          "original_message_id": {
            "type": "string"
          },
          "partner_id": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "tenant_id": {
            "type": "string"
          }
        }
      },
      "MdnMode": {
        "type": "string",
        "description": "How a partner returns the MDN receipt for a message we send.",
        "enum": [
          "none",
          "sync",
          "async"
        ]
      },
      "MicAlgorithm": {
        "type": "string",
        "description": "A digest algorithm usable for the AS2 MIC. SHA-1 is intentionally excluded:\nit is cryptographically broken and modern partners negotiate SHA-2.",
        "enum": [
          "sha256",
          "sha384",
          "sha512"
        ]
      },
      "MintTenantKeyBody": {
        "type": "object",
        "required": [
          "name"
        ],
        "properties": {
          "name": {
            "type": "string",
            "description": "Operator label for the key, e.g. `production-orders`."
          },
          "scopes": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "MonitoringDeadletterScope": {
        "type": "string",
        "description": "Credential visibility of the dead-letter count and its alert.",
        "enum": [
          "platform",
          "tenant"
        ]
      },
      "MonitoringReadScope": {
        "type": "object",
        "description": "Server-reported read boundaries; does not establish delivery or readiness.",
        "required": [
          "tenant_id",
          "deadletters"
        ],
        "properties": {
          "deadletters": {
            "$ref": "#/components/schemas/MonitoringDeadletterScope",
            "description": "Dead letters follow credential scope, even if a platform credential\nselects a tenant with x-tenant-id."
          },
          "tenant_id": {
            "type": "string",
            "description": "Selected tenant for failed deliveries, AS2 receipt callbacks, and the\npartner catalog used to evaluate acknowledgment SLAs."
          }
        }
      },
      "MonitoringSnapshot": {
        "type": "object",
        "description": "Monitoring observations collected from separate sources, not an atomic snapshot.",
        "required": [
          "partner_sla",
          "deadletter_count",
          "failed_deliveries",
          "alerts",
          "healthy"
        ],
        "properties": {
          "alerts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ActiveAlert"
            }
          },
          "deadletter_count": {
            "type": "integer",
            "minimum": 0
          },
          "failed_deliveries": {
            "type": "integer",
            "minimum": 0
          },
          "healthy": {
            "type": "boolean",
            "description": "True when there are no active alerts."
          },
          "partner_sla": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PartnerSla"
            }
          },
          "read_scope": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/MonitoringReadScope",
                "description": "Present for authenticated HTTP reads; absent for legacy or pure evaluations."
              },
              {
                "type": "null"
              }
            ]
          }
        }
      },
      "MovementObservation": {
        "type": "object",
        "required": [
          "id",
          "event_type",
          "stage",
          "source",
          "occurred_at"
        ],
        "properties": {
          "event_type": {
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "occurred_at": {
            "type": "string",
            "format": "date-time"
          },
          "source": {
            "type": "string"
          },
          "stage": {
            "type": "string"
          },
          "status": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "NetSuiteConnectionInput": {
        "type": "object",
        "description": "Connection input for `PUT /v1/adapters/netsuite/connection` (token-based\nauthentication). Secrets are write-only.",
        "required": [
          "account_id",
          "restlet_url",
          "consumer_key",
          "consumer_secret",
          "token_id",
          "token_secret"
        ],
        "properties": {
          "account_id": {
            "type": "string",
            "description": "Account id, e.g. `1234567` or `1234567_SB1`."
          },
          "consumer_key": {
            "type": "string"
          },
          "consumer_secret": {
            "type": "string"
          },
          "restlet_url": {
            "type": "string",
            "description": "`https://{account}.restlets.api.netsuite.com/app/site/hosting/restlet.nl?script=\u2026&deploy=\u2026`"
          },
          "token_id": {
            "type": "string"
          },
          "token_secret": {
            "type": "string"
          }
        },
        "additionalProperties": false
      },
      "NewLead": {
        "type": "object",
        "description": "The public submission payload (server assigns `id`/`created_at`).",
        "required": [
          "email"
        ],
        "properties": {
          "company": {
            "type": "string"
          },
          "email": {
            "type": "string"
          },
          "note": {
            "type": "string"
          },
          "retailer": {
            "type": "string"
          },
          "sample": {
            "type": "string"
          },
          "source": {
            "type": "string"
          }
        }
      },
      "OnboardingEvent": {
        "type": "object",
        "description": "One transition in the audit trail.",
        "required": [
          "at",
          "actor",
          "to_stage"
        ],
        "properties": {
          "actor": {
            "type": "string",
            "description": "Principal that made the change (`admin`, `partner:{id}`, or a system tag)."
          },
          "at": {
            "type": "string",
            "format": "date-time"
          },
          "from_stage": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/OnboardingStage"
              },
              {
                "type": "null"
              }
            ]
          },
          "note": {
            "type": [
              "string",
              "null"
            ]
          },
          "to_stage": {
            "$ref": "#/components/schemas/OnboardingStage"
          }
        }
      },
      "OnboardingRecord": {
        "type": "object",
        "description": "The onboarding record for one partner.",
        "required": [
          "partner_id",
          "tenant_id",
          "stage",
          "history",
          "created_at",
          "updated_at"
        ],
        "properties": {
          "blocker": {
            "type": [
              "string",
              "null"
            ],
            "description": "When set, the partner is blocked at the current stage; advancing is\nrefused until cleared."
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "history": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/OnboardingEvent"
            }
          },
          "partner_id": {
            "type": "string"
          },
          "stage": {
            "$ref": "#/components/schemas/OnboardingStage"
          },
          "tenant_id": {
            "type": "string"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "OnboardingStage": {
        "type": "string",
        "description": "Ordered onboarding stages. Advancing moves one step along this sequence;\nthe index is the source of truth for ordering.",
        "enum": [
          "connected",
          "profile_selected",
          "mapped",
          "testing",
          "certified",
          "live"
        ]
      },
      "OrderLifecycleState": {
        "type": "string",
        "description": "Stable state names shared by the operations API, SDK consumers and the\ndashboard. Values are deliberately lowercase and wire-safe.",
        "enum": [
          "received",
          "validated",
          "acknowledged",
          "ready_for_fulfillment",
          "fulfillment_submitted",
          "fulfillment_accepted",
          "allocated",
          "picking",
          "packed",
          "shipped",
          "asn_pending",
          "asn_sent",
          "asn_acknowledged",
          "invoiced",
          "reconciled",
          "validation_failed",
          "erp_sync_failed",
          "fulfillment_failed",
          "manual_review",
          "asn_failed",
          "invoice_failed",
          "reconciliation_failed",
          "cancellation_pending",
          "cancelled"
        ]
      },
      "OrderObservation": {
        "type": "object",
        "required": [
          "order_id",
          "order_number",
          "order_status",
          "connectors",
          "movements"
        ],
        "properties": {
          "connectors": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ConnectorObservation"
            }
          },
          "movements": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MovementObservation"
            }
          },
          "order_id": {
            "type": "string"
          },
          "order_number": {
            "type": "string"
          },
          "order_status": {
            "type": "string"
          }
        }
      },
      "OutboundAck": {
        "type": "object",
        "description": "The acknowledgment state of one outbound document.",
        "required": [
          "partner_id",
          "transaction_set",
          "control_number",
          "reference",
          "sent_at",
          "status"
        ],
        "properties": {
          "acknowledged_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "control_number": {
            "type": "string"
          },
          "group_control_number": {
            "type": [
              "string",
              "null"
            ],
            "description": "GS06 of the functional group the document was sent in, so a\ngroup-level acknowledgment can settle it."
          },
          "interchange_control_number": {
            "type": [
              "string",
              "null"
            ],
            "description": "ISA13 of the X12 interchange the document was sent in, so a partner\nTA1 rejecting that interchange can settle it."
          },
          "partner_id": {
            "type": "string"
          },
          "reference": {
            "type": "string"
          },
          "sent_at": {
            "type": "string",
            "format": "date-time"
          },
          "status": {
            "type": "string",
            "description": "`pending`, `accepted`, `accepted_with_errors`, `partially_accepted`,\nor `rejected`."
          },
          "transaction_set": {
            "type": "string"
          }
        }
      },
      "OutboundCheck": {
        "oneOf": [
          {
            "type": "object",
            "description": "A segment must be present; with `qualifier`, one whose first element\nequals it (e.g. `N1` + `ST`, `REF` + `BM`).",
            "required": [
              "segment",
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "required_segment"
                ]
              },
              "qualifier": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "segment": {
                "type": "string"
              }
            }
          },
          {
            "type": "object",
            "description": "Where the segment appears (and, with `when_qualifier`, only where its\nfirst element equals that value), `element` must hold one of `allowed`.",
            "required": [
              "segment",
              "element",
              "allowed",
              "kind"
            ],
            "properties": {
              "allowed": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "element": {
                "type": "integer",
                "minimum": 0
              },
              "kind": {
                "type": "string",
                "enum": [
                  "allowed_values"
                ]
              },
              "segment": {
                "type": "string"
              },
              "when_qualifier": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          },
          {
            "type": "object",
            "description": "856 only: every order (`HL*O`) must be packed at carton level \u2014 at\nleast one `HL*P` beneath it (directly or under a pallet `HL*T`), every\npack carrying a `MAN*GM` SSCC, and no item `HL*I` hung straight off the\norder.",
            "required": [
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "carton_level_pack"
                ]
              }
            }
          },
          {
            "type": "object",
            "description": "Every `MAN*GM` value must be an 18-digit SSCC with a valid GS1 check\ndigit (a generic GS1 requirement, applied where labels must scan).",
            "required": [
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "valid_sscc"
                ]
              }
            }
          }
        ],
        "description": "The check an [`OutboundRule`] performs on the built transaction set."
      },
      "OutboundCompliance": {
        "type": "string",
        "description": "Outbound pre-send compliance policy (see [`TradingPartner::outbound_compliance`]).",
        "enum": [
          "off",
          "warn",
          "block"
        ]
      },
      "OutboundIssue": {
        "type": "object",
        "description": "One outbound rule violation.",
        "required": [
          "code",
          "message",
          "source"
        ],
        "properties": {
          "code": {
            "type": "string",
            "description": "Machine-readable code: `missing_segment`, `value_not_allowed`,\n`carton_level_pack_required`, `invalid_sscc`, `invalid_payload`."
          },
          "message": {
            "type": "string"
          },
          "source": {
            "type": "string",
            "description": "The rule's source citation (empty for `invalid_payload`)."
          }
        }
      },
      "OutboundRule": {
        "allOf": [
          {
            "$ref": "#/components/schemas/OutboundCheck"
          },
          {
            "type": "object",
            "required": [
              "set",
              "source"
            ],
            "properties": {
              "set": {
                "type": "string",
                "description": "The outbound transaction set the rule applies to (`856`, `810`)."
              },
              "source": {
                "type": "string",
                "description": "Where the requirement comes from (document + section, or code site)."
              }
            }
          }
        ],
        "description": "A structural rule a document **we send** to the retailer (856 ASN, 810\ninvoice) must satisfy. Only encoded where a source in this repository\nalready asserts the requirement; `source` cites it."
      },
      "OverlaySegment": {
        "type": "object",
        "required": [
          "tag"
        ],
        "properties": {
          "elements": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "tag": {
            "type": "string"
          },
          "transaction_set": {
            "type": [
              "string",
              "null"
            ],
            "description": "Restrict to one transaction set (e.g. `856`); `None` applies to all."
          }
        }
      },
      "PackLevel": {
        "type": "string",
        "description": "A level in the GS1 packaging hierarchy: pallet \u2192 carton \u2192 inner \u2192 each.",
        "enum": [
          "pallet",
          "carton",
          "inner",
          "each"
        ]
      },
      "PackingSlip": {
        "type": "object",
        "description": "A fully-resolved packing slip, ready to render to HTML or ZPL.",
        "required": [
          "shipment_id",
          "ship_date",
          "ship_from",
          "ship_to",
          "orders",
          "carton_count",
          "total_units",
          "profile"
        ],
        "properties": {
          "bol_number": {
            "type": [
              "string",
              "null"
            ]
          },
          "carrier_scac": {
            "type": [
              "string",
              "null"
            ]
          },
          "carton_count": {
            "type": "integer",
            "description": "Number of cartons across all orders (1 for an order-level ASN).",
            "minimum": 0
          },
          "orders": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SlipOrder"
            }
          },
          "profile": {
            "$ref": "#/components/schemas/PackingSlipProfile"
          },
          "ship_date": {
            "type": "string"
          },
          "ship_from": {
            "$ref": "#/components/schemas/Address"
          },
          "ship_to": {
            "$ref": "#/components/schemas/Address"
          },
          "shipment_id": {
            "type": "string"
          },
          "total_units": {
            "type": "string",
            "description": "Total units across every line."
          },
          "tracking_number": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "PackingSlipProfile": {
        "type": "object",
        "description": "Per-partner packing-slip presentation. Defaults are sensible for a generic\nslip; a partner overlay overrides the fields its companion guide mandates.",
        "required": [
          "seller_name"
        ],
        "properties": {
          "footer_note": {
            "type": [
              "string",
              "null"
            ],
            "description": "Optional footer note (return policy, compliance marks, partner-required\nstatements)."
          },
          "logo_text": {
            "type": [
              "string",
              "null"
            ],
            "description": "Optional logo / brand line printed above the seller name."
          },
          "seller_name": {
            "type": "string",
            "description": "Seller / shipper name printed in the header (the \"from\" identity)."
          },
          "show_sscc": {
            "type": "boolean",
            "description": "When true, render each carton's SSCC alongside its contents \u2014 required\nby retailers that scan the slip against the carton label."
          }
        }
      },
      "PageInfo": {
        "type": "object",
        "description": "Pagination metadata carried alongside a paged list's `data`.",
        "required": [
          "total",
          "limit",
          "offset"
        ],
        "properties": {
          "limit": {
            "type": "integer",
            "description": "The applied page size (after clamping).",
            "minimum": 0
          },
          "offset": {
            "type": "integer",
            "description": "The applied offset.",
            "minimum": 0
          },
          "total": {
            "type": "integer",
            "description": "Total records available (before paging).",
            "minimum": 0
          }
        }
      },
      "PagedDeliveries": {
        "type": "object",
        "required": [
          "success",
          "data",
          "page"
        ],
        "properties": {
          "data": {
            "$ref": "#/components/schemas/DeliveryPageData"
          },
          "page": {
            "$ref": "#/components/schemas/PageInfo"
          },
          "success": {
            "type": "boolean"
          }
        }
      },
      "PagedDocuments": {
        "type": "object",
        "description": "The `GET /v1/documents` response envelope. Typed (not `json!`) so the\nOpenAPI schema and the wire shape cannot drift apart.",
        "required": [
          "success",
          "data",
          "page"
        ],
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DocumentListEntry"
            },
            "description": "The requested page, newest first."
          },
          "page": {
            "$ref": "#/components/schemas/PageInfo"
          },
          "success": {
            "type": "boolean"
          }
        }
      },
      "PartnerOverlay": {
        "type": "object",
        "description": "A per-partner outbound overlay: the configurable slice of a companion guide.\nApplied to a built X12 transaction set before enveloping, so the same codec\nserves every partner and their idiosyncrasies live on the partner record.",
        "properties": {
          "element_overrides": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ElementOverride"
            },
            "description": "Force an element's value on the first matching segment of an outbound\ntransaction (optionally scoped to a set) \u2014 e.g. a fixed qualifier."
          },
          "extra_segments": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/OverlaySegment"
            },
            "description": "Extra segments appended to outbound transactions (optionally scoped to a\ntransaction set) \u2014 e.g. a partner-required `REF`/`N9`/`DTM`."
          }
        }
      },
      "PartnerSla": {
        "type": "object",
        "description": "Per-partner acknowledgment SLA status.",
        "required": [
          "partner_id",
          "sla_hours",
          "outstanding",
          "overdue",
          "breached"
        ],
        "properties": {
          "breached": {
            "type": "boolean"
          },
          "outstanding": {
            "type": "integer",
            "description": "Documents still awaiting a 997.",
            "minimum": 0
          },
          "overdue": {
            "type": "integer",
            "description": "Outstanding documents past this partner's SLA.",
            "minimum": 0
          },
          "partner_id": {
            "type": "string"
          },
          "sla_hours": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          }
        }
      },
      "PartnerTemplate": {
        "type": "object",
        "description": "A reusable, inheritable partner configuration derived from a (certified)\ntrading partner \u2014 the retailer's guide + map without any relationship data.",
        "required": [
          "id",
          "name",
          "partner_isa_qualifier",
          "version",
          "validation",
          "certified",
          "reuse_count",
          "created_at",
          "updated_at"
        ],
        "properties": {
          "certification_pack": {
            "type": [
              "string",
              "null"
            ],
            "description": "The certification pack the source partner passed, when known."
          },
          "certified": {
            "type": "boolean",
            "description": "Whether this template was published from a partner that passed\ncertification (vs. an ad-hoc publish)."
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "delimiters": {
            "$ref": "#/components/schemas/Delimiters"
          },
          "id": {
            "type": "string",
            "description": "Stable id, derived from the partner name + version so re-certifying the\nsame retailer updates rather than duplicates."
          },
          "label": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/LabelProfile",
                "description": "Label placement profile, when the source partner had one."
              },
              {
                "type": "null"
              }
            ]
          },
          "name": {
            "type": "string"
          },
          "overlay": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/PartnerOverlay",
                "description": "The companion-guide overlay (the \"map\"), when the source partner had one."
              },
              {
                "type": "null"
              }
            ]
          },
          "packing_slip": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/PackingSlipProfile",
                "description": "Packing-slip presentation overlay, when present."
              },
              {
                "type": "null"
              }
            ]
          },
          "partner_isa_qualifier": {
            "type": "string",
            "description": "The retailer's ISA interchange ID qualifier (theirs, not the tenant's)."
          },
          "publisher_tenant": {
            "type": [
              "string",
              "null"
            ],
            "description": "The tenant that published this template; `None` for platform-published\n(and legacy) templates. Only the publisher \u2014 or the platform operator \u2014\nmay overwrite it, so one tenant can't rewrite another's shared guide."
          },
          "reuse_count": {
            "type": "integer",
            "format": "int32",
            "description": "How many times another tenant has inherited this template \u2014 the flywheel\nmetric. A high reuse count means the Nth tenant onboards instantly.",
            "minimum": 0
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "validation": {
            "$ref": "#/components/schemas/PartnerValidation",
            "description": "The implementation-guide validation rules (the \"guide\")."
          },
          "version": {
            "type": "string"
          }
        }
      },
      "PartnerValidation": {
        "type": "object",
        "description": "Per-partner inbound validation. Empty rules accept everything (the default),\nso existing partners are unaffected.",
        "properties": {
          "accepted_inbound": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "If non-empty, inbound transaction sets not in this list are rejected\n(e.g. `[\"850\", \"860\"]` for a partner that only sends orders)."
          },
          "accepted_versions": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "If non-empty, an inbound functional group whose GS08 version is not in\nthis list is rejected (SNIP level 2). Empty accepts any supported\nversion \u2014 e.g. `[\"005010\"]` pins a partner certified only on 5010."
          },
          "conditional_rules": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ConditionalRule"
            },
            "description": "If-then rules, e.g. \"when BEG02 is SA, a DTM segment is required\"."
          },
          "count_checks": {
            "type": "object",
            "description": "Count-balancing rules per inbound transaction set \u2014 `CTT01` must equal\nthe number of `PO1` segments and friends. Checked only when the counter\nsegment is present (pair with `required_segments` to mandate it).",
            "additionalProperties": {
              "type": "array",
              "items": {
                "$ref": "#/components/schemas/CountRule"
              }
            },
            "propertyNames": {
              "type": "string"
            }
          },
          "element_constraints": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ElementConstraint"
            },
            "description": "Element-level constraints applied to matching segments anywhere in an\ninbound document \u2014 e.g. pin PO1-03 (unit of measure) to an allowed set."
          },
          "enforce_x12_envelope_identity": {
            "type": "boolean",
            "description": "Require inbound X12 ISA sender/receiver qualifiers and IDs, plus ISA15,\nto match this partner even when the caller supplies an explicit partner ID."
          },
          "enforce_x12_group_identity": {
            "type": "boolean",
            "description": "Require every inbound X12 GS02/GS03 to match the configured application\nsender/receiver IDs (falling back to ISA IDs when GS IDs are unset)."
          },
          "outbound_rules": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/OutboundRule"
            },
            "description": "Sourced checks for generated 855/856/810 wire, evaluated after overlays.\nStored with guide snapshots and included in readiness fingerprints."
          },
          "required_qualified": {
            "type": "object",
            "description": "Qualified-segment requirements per inbound transaction set \u2014 the guide\nstaple `required_references` can't reach beyond REF: \"a DTM*002\n(delivery date) must be present\", \"an N1 loop with N101=ST\". The `\"*\"`\nkey applies to every set.",
            "additionalProperties": {
              "type": "array",
              "items": {
                "$ref": "#/components/schemas/QualifiedSegmentRule"
              }
            },
            "propertyNames": {
              "type": "string"
            }
          },
          "required_references": {
            "type": "object",
            "description": "REF qualifiers that must be present per inbound transaction set, e.g.\n`{\"850\": [\"DP\"]}` to require a department-number reference on every PO.",
            "additionalProperties": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "propertyNames": {
              "type": "string"
            }
          },
          "required_segments": {
            "type": "object",
            "description": "Segment tags that must be present per inbound transaction set, e.g.\n`{\"850\": [\"DTM\", \"REF\"]}` to require a date and reference on every PO.\nThe `\"*\"` key applies to every inbound set.",
            "additionalProperties": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "propertyNames": {
              "type": "string"
            }
          },
          "segment_cardinality": {
            "type": "object",
            "description": "Occurrence bounds per inbound transaction set, e.g.\n`{\"850\": [{\"segment\": \"BEG\", \"min\": 1, \"max\": 1}]}` for \"exactly one\nBEG\" or a guide's \"max 200 PO1 lines\". The `\"*\"` key applies to every\nset; a set-specific rule for the same segment takes precedence.",
            "additionalProperties": {
              "type": "array",
              "items": {
                "$ref": "#/components/schemas/CardinalityRule"
              }
            },
            "propertyNames": {
              "type": "string"
            }
          },
          "warning_codes": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Validation issue codes (e.g. `too_long`, `value_not_allowed`) that are\nadvisory for this partner: matching issues are reported on the\naccepted document and acknowledged `E` (accepted with errors) in the\n997/999 instead of rejecting the transaction. For EDIFACT, a parsed,\nmapped message is accepted with findings in the report and ledger;\nCONTRL reports acceptance without inventing a syntax-error code.\nUnlisted guide codes and parser failures still reject."
          }
        }
      },
      "PartnerVolume": {
        "type": "object",
        "description": "Volume + quality for one partner.",
        "required": [
          "partner_id",
          "total",
          "inbound",
          "outbound",
          "accepted",
          "rejected"
        ],
        "properties": {
          "accepted": {
            "type": "integer",
            "minimum": 0
          },
          "error_rate": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int32",
            "description": "Rejected \u00f7 (accepted + rejected), percent 0\u2013100. `None` if none decided.",
            "minimum": 0
          },
          "inbound": {
            "type": "integer",
            "minimum": 0
          },
          "outbound": {
            "type": "integer",
            "minimum": 0
          },
          "partner_id": {
            "type": "string"
          },
          "rejected": {
            "type": "integer",
            "minimum": 0
          },
          "total": {
            "type": "integer",
            "minimum": 0
          }
        }
      },
      "Party": {
        "type": "object",
        "description": "An N1 party loop (N1/N2/N3/N4).",
        "required": [
          "role",
          "name"
        ],
        "properties": {
          "address_lines": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "city": {
            "type": [
              "string",
              "null"
            ]
          },
          "country": {
            "type": [
              "string",
              "null"
            ]
          },
          "id": {
            "type": [
              "string",
              "null"
            ]
          },
          "id_qualifier": {
            "type": [
              "string",
              "null"
            ],
            "description": "N103/N104 \u2014 identification qualifier and code (e.g. `92` + store #)."
          },
          "name": {
            "type": "string"
          },
          "postal_code": {
            "type": [
              "string",
              "null"
            ]
          },
          "role": {
            "type": "string",
            "description": "N101 entity identifier code: ST ship-to, BT bill-to, SF ship-from,\nVN vendor, BY buyer, ..."
          },
          "state": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "PoAck855": {
        "type": "object",
        "description": "Parsed inbound 855. Fields are tolerant (optional) since a supplier may\nsend only header-level acknowledgment.",
        "required": [
          "po_number",
          "ack_type",
          "lines"
        ],
        "properties": {
          "ack_date": {
            "type": [
              "string",
              "null"
            ],
            "format": "date",
            "description": "BAK09 (or BAK04) acknowledgment date."
          },
          "ack_type": {
            "type": "string",
            "description": "BAK02 \u2014 acknowledgment type: AC accept, AD accept w/ detail,\nAK acknowledge, RJ reject."
          },
          "lines": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AckLineParsed"
            }
          },
          "po_number": {
            "type": "string",
            "description": "BAK03 \u2014 the PO being acknowledged (ours)."
          }
        }
      },
      "PoChange860": {
        "type": "object",
        "required": [
          "po_number",
          "purpose",
          "po_type",
          "lines"
        ],
        "properties": {
          "change_date": {
            "type": [
              "string",
              "null"
            ],
            "format": "date",
            "description": "BCH11 \u2014 date of this change."
          },
          "dates": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Reference"
            }
          },
          "lines": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ChangeLine"
            }
          },
          "parties": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Party"
            }
          },
          "po_date": {
            "type": [
              "string",
              "null"
            ],
            "format": "date",
            "description": "BCH06 \u2014 original PO date."
          },
          "po_number": {
            "type": "string",
            "description": "BCH03."
          },
          "po_type": {
            "type": "string",
            "description": "BCH02 \u2014 PO type."
          },
          "purpose": {
            "type": "string",
            "description": "BCH01 \u2014 transaction set purpose (01 cancellation, 04 change, 05\nreplace)."
          },
          "references": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Reference"
            }
          }
        }
      },
      "PoChangeAck865": {
        "type": "object",
        "description": "Parsed inbound 865. Tolerant like the inbound 855: header-only\nacknowledgments are valid.",
        "required": [
          "po_number",
          "ack_type",
          "lines"
        ],
        "properties": {
          "ack_date": {
            "type": [
              "string",
              "null"
            ],
            "format": "date",
            "description": "BCA09 (or BCA06) acknowledgment date."
          },
          "ack_type": {
            "type": "string",
            "description": "BCA02 \u2014 acknowledgment type."
          },
          "lines": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ChangeAckLineParsed"
            }
          },
          "po_number": {
            "type": "string",
            "description": "BCA03 \u2014 the changed PO."
          }
        }
      },
      "PoLine": {
        "type": "object",
        "required": [
          "line_number",
          "quantity",
          "uom"
        ],
        "properties": {
          "description": {
            "type": [
              "string",
              "null"
            ],
            "description": "PID05 of the F-format item description, when present."
          },
          "ids": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ProductId"
            },
            "description": "PO106+ qualifier/value pairs."
          },
          "line_number": {
            "type": "string",
            "description": "PO101 \u2014 buyer's line number."
          },
          "parties": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Party"
            },
            "description": "N1 parties inside this line's PO1 loop (e.g. a store-level ship-to on\na cross-dock order) \u2014 distinct from the order's header parties."
          },
          "quantity": {
            "type": "string",
            "description": "PO102 / PO103."
          },
          "unit_price": {
            "type": [
              "string",
              "null"
            ],
            "description": "PO104 (PO105 is the basis, almost always PE = per each)."
          },
          "uom": {
            "type": "string"
          }
        }
      },
      "PostalDeclaration": {
        "type": "object",
        "description": "A CN22 or CN23 postal customs declaration derived from a commercial invoice.",
        "required": [
          "form",
          "category",
          "items",
          "total_value",
          "currency",
          "complete"
        ],
        "properties": {
          "category": {
            "$ref": "#/components/schemas/CustomsCategory"
          },
          "complete": {
            "type": "boolean",
            "description": "True when every item carries an HS code, origin, and weight \u2014 what a\ncompliant CN23 needs."
          },
          "currency": {
            "type": "string"
          },
          "destination_country": {
            "type": [
              "string",
              "null"
            ]
          },
          "form": {
            "$ref": "#/components/schemas/PostalForm"
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PostalItem"
            }
          },
          "origin_country": {
            "type": [
              "string",
              "null"
            ]
          },
          "total_value": {
            "type": "string"
          },
          "total_weight_kg": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "PostalForm": {
        "type": "string",
        "description": "The postal customs declaration form. CN22 is the short form for low-value /\nlight parcels; CN23 is the detailed form above the threshold.",
        "enum": [
          "CN22",
          "CN23"
        ]
      },
      "PostalItem": {
        "type": "object",
        "description": "One item line on a postal declaration.",
        "required": [
          "description",
          "quantity",
          "value"
        ],
        "properties": {
          "description": {
            "type": "string"
          },
          "hs_code": {
            "type": [
              "string",
              "null"
            ]
          },
          "net_weight_kg": {
            "type": [
              "string",
              "null"
            ]
          },
          "origin": {
            "type": [
              "string",
              "null"
            ]
          },
          "quantity": {
            "type": "string"
          },
          "value": {
            "type": "string"
          }
        }
      },
      "ProductId": {
        "type": "object",
        "description": "One qualifier/value product identifier pair from a PO1/IT1/LIN segment\n(SK seller SKU, VN vendor part, UP UPC, BP buyer part, IN buyer item, ...).",
        "required": [
          "qualifier",
          "value"
        ],
        "properties": {
          "qualifier": {
            "type": "string"
          },
          "value": {
            "type": "string"
          }
        }
      },
      "ProfileCheckDocument": {
        "type": "object",
        "description": "One transaction set's conformance verdict within a checked interchange.",
        "required": [
          "transaction_set",
          "control_number",
          "accepted"
        ],
        "properties": {
          "accepted": {
            "type": "boolean"
          },
          "control_number": {
            "type": "string"
          },
          "issues": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ValidationIssue"
            },
            "description": "Every guide violation, with 999-grade segment/element positions."
          },
          "transaction_set": {
            "type": "string"
          }
        }
      },
      "ProfileCheckReport": {
        "type": "object",
        "description": "The result of checking one uploaded interchange against a retailer profile.",
        "required": [
          "retailer",
          "profile_key",
          "guide",
          "status",
          "valid",
          "documents"
        ],
        "properties": {
          "documents": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ProfileCheckDocument"
            }
          },
          "guide": {
            "type": "string"
          },
          "profile_key": {
            "type": "string"
          },
          "retailer": {
            "type": "string"
          },
          "status": {
            "$ref": "#/components/schemas/ProfileStatus"
          },
          "structural_error": {
            "type": [
              "string",
              "null"
            ],
            "description": "Set when the interchange could not be parsed at all."
          },
          "valid": {
            "type": "boolean",
            "description": "True only when the interchange parsed and every document passed the guide."
          }
        }
      },
      "ProfileStatus": {
        "type": "string",
        "description": "Whether a profile carries real element-level rules from a public guide, or is\na set-list-only stub awaiting the retailer's gated companion guide.",
        "enum": [
          "certified",
          "placeholder",
          "provisional"
        ]
      },
      "PurchaseOrder850": {
        "type": "object",
        "required": [
          "po_number",
          "purpose",
          "po_type",
          "lines"
        ],
        "properties": {
          "currency": {
            "type": [
              "string",
              "null"
            ],
            "description": "CUR02."
          },
          "dates": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Reference"
            },
            "description": "DTM segments keyed by qualifier (002 delivery requested, 010 requested\nship, ...). Stored as (qualifier, CCYYMMDD date)."
          },
          "lines": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PoLine"
            }
          },
          "parties": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Party"
            }
          },
          "po_date": {
            "type": [
              "string",
              "null"
            ],
            "format": "date",
            "description": "BEG05."
          },
          "po_number": {
            "type": "string",
            "description": "BEG03."
          },
          "po_type": {
            "type": "string",
            "description": "BEG02 \u2014 PO type (SA stand-alone, NE new order, RL release, ...)."
          },
          "purpose": {
            "type": "string",
            "description": "BEG01 \u2014 transaction set purpose (00 original, 01 cancellation, ...)."
          },
          "references": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Reference"
            }
          }
        }
      },
      "QualifiedSegmentRule": {
        "type": "object",
        "description": "Requires at least one occurrence of a segment whose qualifier element\ncarries a specific value \u2014 e.g. segment `DTM`, element 1, value `002`.",
        "required": [
          "segment",
          "element",
          "value"
        ],
        "properties": {
          "element": {
            "type": "integer",
            "description": "1-based qualifier element position (usually 1).",
            "minimum": 0
          },
          "segment": {
            "type": "string",
            "description": "Segment tag, e.g. `DTM` or `N1`."
          },
          "value": {
            "type": "string",
            "description": "Required qualifier value, e.g. `002` or `ST`."
          }
        }
      },
      "ReadinessReport": {
        "type": "object",
        "required": [
          "report_version",
          "generated_at",
          "platform_version",
          "tenant_id",
          "partner_id",
          "configuration_hash",
          "requirements",
          "missing",
          "evidence",
          "evidence_status",
          "standard_pack_hashes",
          "infrastructure_ready",
          "ready_for_production",
          "production_blockers",
          "onboarding",
          "usage",
          "acceptance_notice"
        ],
        "properties": {
          "acceptance_notice": {
            "type": "string"
          },
          "configuration_hash": {
            "type": "string",
            "description": "Evidence binding that deliberately survives test/production promotion."
          },
          "evidence": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Evidence"
            }
          },
          "evidence_status": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/EvidenceStatus"
            }
          },
          "generated_at": {
            "type": "string",
            "format": "date-time"
          },
          "infrastructure_ready": {
            "type": "boolean"
          },
          "missing": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "onboarding": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/OnboardingRecord"
              },
              {
                "type": "null"
              }
            ]
          },
          "partner_id": {
            "type": "string"
          },
          "platform_version": {
            "type": "string"
          },
          "production_blockers": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "ready_for_production": {
            "type": "boolean",
            "description": "True only when production evidence, infrastructure, onboarding and\nenvelope checks have no blockers; not independent retailer approval."
          },
          "report_version": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "requirements": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "standard_pack_hashes": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "tenant_id": {
            "type": "string"
          },
          "usage": {
            "type": "string",
            "description": "Captured partner envelope environment (T/P), checked separately from hash."
          }
        }
      },
      "ReadinessResponse": {
        "type": "object",
        "required": [
          "success",
          "data"
        ],
        "properties": {
          "data": {
            "$ref": "#/components/schemas/ReadinessReport"
          },
          "success": {
            "type": "boolean",
            "description": "The report was generated; eligibility is data.ready_for_production."
          }
        }
      },
      "RecordedSeverity": {
        "type": "string",
        "description": "Severity recorded by the producer of a document-ledger finding.",
        "enum": [
          "error",
          "warning"
        ]
      },
      "RedeliverBulkBody": {
        "type": "object",
        "properties": {
          "partner_id": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "Reference": {
        "type": "object",
        "description": "A REF segment.",
        "required": [
          "qualifier",
          "value"
        ],
        "properties": {
          "qualifier": {
            "type": "string"
          },
          "value": {
            "type": "string"
          }
        }
      },
      "RejectionDetail": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ValidationIssue"
          },
          {
            "type": "object",
            "required": [
              "snip_level",
              "severity"
            ],
            "properties": {
              "severity": {
                "type": "string",
                "description": "Effective processing severity: `error` or `warning`. Accepted advisory\nfindings use `warning`, preserving their SNIP classification and detail."
              },
              "snip_level": {
                "type": "integer",
                "format": "int32",
                "description": "SNIP integrity level: 2 envelope, 3 implementation-guide,\n4 value/code-set.",
                "minimum": 0
              },
              "suggested_fix": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "A short remediation hint, when one is known for this issue's code."
              }
            }
          }
        ],
        "description": "An API-surfaced guide finding: a [`ValidationIssue`] plus its SNIP integrity\nclassification and effective processing severity. Receipt `rejection`\nfindings and stored-document `validation_issues` expose the segment/element,\nSNIP level, severity, and remediation hint together, including accepted warnings."
      },
      "Remittance820": {
        "type": "object",
        "required": [
          "total_amount",
          "items"
        ],
        "properties": {
          "credit_debit": {
            "type": [
              "string",
              "null"
            ],
            "description": "BPR03 \u2014 credit/debit flag (`C` credit, `D` debit)."
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RemittanceItem"
            }
          },
          "parties": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Party"
            }
          },
          "payment_date": {
            "type": [
              "string",
              "null"
            ],
            "format": "date",
            "description": "BPR16 \u2014 payment effective date."
          },
          "payment_method": {
            "type": [
              "string",
              "null"
            ],
            "description": "BPR04 \u2014 payment method (ACH, CHK, FWT, ...)."
          },
          "total_amount": {
            "type": "string",
            "description": "BPR02 \u2014 total payment amount (explicit decimal)."
          },
          "trace_number": {
            "type": [
              "string",
              "null"
            ],
            "description": "TRN02 \u2014 check / EFT trace number."
          }
        }
      },
      "RemittanceItem": {
        "type": "object",
        "required": [
          "invoice_number"
        ],
        "properties": {
          "amount_paid": {
            "type": [
              "string",
              "null"
            ],
            "description": "RMR04 \u2014 amount actually paid for this item."
          },
          "gross_amount": {
            "type": [
              "string",
              "null"
            ],
            "description": "RMR05 \u2014 gross (original) amount of the item."
          },
          "invoice_number": {
            "type": "string",
            "description": "RMR02 \u2014 the invoice (or other) number being settled."
          },
          "reference_qualifier": {
            "type": [
              "string",
              "null"
            ],
            "description": "RMR01 \u2014 reference qualifier (IV invoice, PO purchase order, ...)."
          }
        }
      },
      "ReprocessBulkBody": {
        "type": "object",
        "properties": {
          "partner_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "type": [
              "string",
              "null"
            ],
            "description": "Only documents in this status (e.g. `rejected`). Omit for all inbound."
          },
          "transaction_set": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "RetailClosurePolicy": {
        "type": "string",
        "enum": [
          "standard",
          "unfulfilled_terminal_review"
        ]
      },
      "RetailerProfile": {
        "type": "object",
        "description": "A built-in retailer companion-guide profile.",
        "required": [
          "key",
          "name",
          "guide",
          "source",
          "status",
          "validation",
          "notes"
        ],
        "properties": {
          "guide": {
            "type": "string",
            "description": "The guide edition this profile transcribes."
          },
          "key": {
            "type": "string",
            "description": "Stable lookup key, e.g. `walmart`."
          },
          "name": {
            "type": "string",
            "description": "Display name."
          },
          "notes": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Operator-facing notes (caveats, pending work, direction)."
          },
          "outbound_rules": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/OutboundRule"
            },
            "description": "Structural rules for the documents we send this retailer (856/810),\nchecked by [`RetailerProfile::check_outbound`]. Empty unless a source\nasserts them \u2014 placeholders never carry any."
          },
          "source": {
            "type": "string",
            "description": "Where the rules came from (guide title or public source)."
          },
          "status": {
            "$ref": "#/components/schemas/ProfileStatus"
          },
          "validation": {
            "$ref": "#/components/schemas/PartnerValidation",
            "description": "The inbound validation rules a partner gets when this profile is applied."
          }
        }
      },
      "RotateAs2IdentityBody": {
        "type": "object",
        "description": "Request body for rotating the AS2 S/MIME identity at runtime.",
        "required": [
          "key_pem",
          "cert_pem"
        ],
        "properties": {
          "cert_pem": {
            "type": "string",
            "description": "X.509 certificate PEM."
          },
          "key_pem": {
            "type": "string",
            "description": "PKCS#8 private key PEM."
          }
        }
      },
      "RoutedOrder": {
        "type": "object",
        "required": [
          "po_number"
        ],
        "properties": {
          "po_number": {
            "type": "string",
            "description": "OID02 / PRF01 \u2014 the PO number."
          },
          "quantity": {
            "type": [
              "string",
              "null"
            ],
            "description": "OID05 \u2014 quantity (cartons) routed."
          },
          "reference": {
            "type": [
              "string",
              "null"
            ],
            "description": "OID01 \u2014 the supplier reference echoed back, when present."
          },
          "weight": {
            "type": [
              "string",
              "null"
            ],
            "description": "OID07 \u2014 weight routed."
          }
        }
      },
      "RoutingInstructions754": {
        "type": "object",
        "required": [
          "routing_id"
        ],
        "properties": {
          "appointment_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "Appointment identifier, derived from a reference qualified `AO`."
          },
          "carrier_scac": {
            "type": [
              "string",
              "null"
            ],
            "description": "TD503 of the first TD5 \u2014 the assigned carrier's SCAC."
          },
          "dates": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Reference"
            },
            "description": "Every G62 as (qualifier, CCYYMMDD), with the time appended as\n`CCYYMMDDHHMM` when G62 carries one."
          },
          "issue_date": {
            "type": [
              "string",
              "null"
            ],
            "format": "date",
            "description": "BGN03 \u2014 date the instructions were issued."
          },
          "load_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "Load identifier, derived from a reference qualified `LO` (load\nplanning number) or `CN` (carrier's reference), in that order."
          },
          "orders": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RoutedOrder"
            },
            "description": "The POs these instructions cover (OID detail or PRF references)."
          },
          "parties": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Party"
            }
          },
          "pickup_date": {
            "type": [
              "string",
              "null"
            ],
            "format": "date",
            "description": "The earliest pickup date, derived from `dates` (G62 qualifier `69`\npreferred, else the first G62 date)."
          },
          "purpose": {
            "type": [
              "string",
              "null"
            ],
            "description": "BGN01 \u2014 transaction set purpose (00 original, 04 change, 01 cancel\u2026)."
          },
          "references": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Reference"
            },
            "description": "Every header reference, verbatim: `N9*q*v`, `L11*v*q`, `REF*q*v`."
          },
          "routing": {
            "type": [
              "string",
              "null"
            ],
            "description": "TD505 \u2014 routing / carrier name, when given."
          },
          "routing_id": {
            "type": "string",
            "description": "BGN02 \u2014 the routing reference (typically echoes the 753 request id)."
          },
          "transport_method": {
            "type": [
              "string",
              "null"
            ],
            "description": "TD504 \u2014 transportation method, when given."
          }
        }
      },
      "RoutingOrder": {
        "type": "object",
        "required": [
          "po_number",
          "cartons",
          "weight"
        ],
        "properties": {
          "cartons": {
            "type": "integer",
            "format": "int32",
            "description": "OID04/OID05 \u2014 number of cartons (packaging code `CTN`).",
            "minimum": 0
          },
          "po_number": {
            "type": "string",
            "description": "OID02 \u2014 the retailer's PO number."
          },
          "reference": {
            "type": [
              "string",
              "null"
            ],
            "description": "OID01 \u2014 an optional supplier reference for this PO's freight (e.g.\nthe supplier's order or shipment line id)."
          },
          "volume": {
            "type": [
              "string",
              "null"
            ],
            "description": "OID09 \u2014 volume of this PO's freight, when measured."
          },
          "weight": {
            "type": "string",
            "description": "OID07 \u2014 gross weight of this PO's freight."
          }
        }
      },
      "RoutingRequest753": {
        "type": "object",
        "required": [
          "request_id",
          "ready_date",
          "ship_from",
          "orders"
        ],
        "properties": {
          "orders": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RoutingOrder"
            },
            "description": "One entry per purchase order the shipment covers."
          },
          "pallets": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int32",
            "description": "Total pallets in the shipment (AT804). Omit for floor-loaded freight.",
            "minimum": 0
          },
          "ready_date": {
            "type": "string",
            "format": "date",
            "description": "G62 \u2014 date the freight is ready to ship (qualifier from\n`ready_date_qualifier`, default `10`)."
          },
          "ready_date_qualifier": {
            "type": [
              "string",
              "null"
            ],
            "description": "G62 date qualifier for `ready_date`. Guides differ; override when the\nretailer's routing guide calls for another code."
          },
          "request_date": {
            "type": [
              "string",
              "null"
            ],
            "format": "date",
            "description": "BGN03 \u2014 date the request was created. Defaults to `ready_date`."
          },
          "request_id": {
            "type": "string",
            "description": "BGN02 \u2014 the supplier's routing-request identifier (the retailer echoes\nit in the 754)."
          },
          "ship_from": {
            "$ref": "#/components/schemas/Party",
            "description": "N1*SF loop \u2014 where the freight is picked up."
          },
          "ship_to": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/Party",
                "description": "N1*ST loop \u2014 the destination, when known (often the retailer's DC)."
              },
              {
                "type": "null"
              }
            ]
          },
          "volume_uom": {
            "type": [
              "string",
              "null"
            ],
            "description": "Volume unit for every volume in the request (AT806/OID08; default `E`\ncubic feet)."
          },
          "weight_uom": {
            "type": [
              "string",
              "null"
            ],
            "description": "Weight unit for every weight in the request (AT802/OID06; default `L`\npounds)."
          }
        }
      },
      "SandboxLine": {
        "type": "object",
        "required": [
          "sku",
          "quantity"
        ],
        "properties": {
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "quantity": {
            "type": "string"
          },
          "sku": {
            "type": "string"
          },
          "sku_qualifier": {
            "type": [
              "string",
              "null"
            ],
            "description": "PO1 identifier qualifier for `sku` (default `VN`)."
          },
          "unit_price": {
            "type": [
              "string",
              "null"
            ]
          },
          "uom": {
            "type": [
              "string",
              "null"
            ],
            "description": "Unit of measure (default: the partner guide's first allowed PO103, else EA)."
          }
        }
      },
      "SandboxRequest": {
        "type": "object",
        "description": "Optional overrides for a sandbox run. Everything defaults.",
        "properties": {
          "lines": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SandboxLine"
            },
            "description": "PO lines (default: one line of 12 units)."
          },
          "new_quantity": {
            "type": [
              "string",
              "null"
            ],
            "description": "`po_change`: the new quantity for line 1 (default: half the ordered\nquantity, at least 1)."
          },
          "po_number": {
            "type": [
              "string",
              "null"
            ],
            "description": "PO number for the synthetic 850 (default `SBX-<random>`). Ignored by\n`bad_po`, which omits it on purpose."
          }
        }
      },
      "SegmentError": {
        "type": "object",
        "description": "One segment-level error a partner reported against our document, with\nits element-level detail.",
        "required": [
          "segment"
        ],
        "properties": {
          "code": {
            "type": [
              "string",
              "null"
            ],
            "description": "AK304 \u2014 segment syntax error code."
          },
          "elements": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ElementError"
            },
            "description": "AK4 element errors within the segment."
          },
          "position": {
            "type": [
              "string",
              "null"
            ],
            "description": "AK302 \u2014 position in the transaction set."
          },
          "segment": {
            "type": "string",
            "description": "AK301 \u2014 segment ID."
          }
        }
      },
      "SetVolume": {
        "type": "object",
        "description": "Count for one transaction set.",
        "required": [
          "transaction_set",
          "count"
        ],
        "properties": {
          "count": {
            "type": "integer",
            "minimum": 0
          },
          "transaction_set": {
            "type": "string"
          }
        }
      },
      "Ship940": {
        "type": "object",
        "required": [
          "order_number",
          "items"
        ],
        "properties": {
          "carrier_scac": {
            "type": [
              "string",
              "null"
            ],
            "description": "W6603 \u2014 carrier SCAC for routing."
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ShipItem"
            }
          },
          "order_number": {
            "type": "string",
            "description": "W0502 \u2014 depositor (our) order number."
          },
          "po_number": {
            "type": [
              "string",
              "null"
            ],
            "description": "W0503 \u2014 the customer PO this order fulfills, when there is one."
          },
          "requested_ship_date": {
            "type": [
              "string",
              "null"
            ],
            "format": "date",
            "description": "G62*10 \u2014 requested ship date."
          },
          "ship_to": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/Party"
              },
              {
                "type": "null"
              }
            ]
          }
        }
      },
      "ShipItem": {
        "type": "object",
        "required": [
          "quantity",
          "sku"
        ],
        "properties": {
          "description": {
            "type": [
              "string",
              "null"
            ],
            "description": "G69 free-form description line."
          },
          "quantity": {
            "type": "string"
          },
          "sku": {
            "type": "string"
          },
          "sku_qualifier": {
            "type": "string",
            "description": "W0104 qualifier for the identifier, e.g. SK / VN / UP."
          },
          "uom": {
            "type": "string"
          }
        }
      },
      "ShopifyConnectionInput": {
        "type": "object",
        "description": "Connection input for `PUT /v1/adapters/shopify/connection`.",
        "required": [
          "shop_domain",
          "admin_token"
        ],
        "properties": {
          "admin_token": {
            "type": "string",
            "description": "Custom-app Admin API access token (`shpat_\u2026`). Write-only."
          },
          "api_version": {
            "type": [
              "string",
              "null"
            ],
            "description": "Admin API version, `YYYY-MM`; defaults to the platform default."
          },
          "shop_domain": {
            "type": "string",
            "description": "`{shop}.myshopify.com`."
          }
        },
        "additionalProperties": false
      },
      "SlipCarton": {
        "type": "object",
        "description": "A carton (pack) and its contents, when the ASN is carton-level.",
        "required": [
          "lines"
        ],
        "properties": {
          "lines": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SlipLine"
            }
          },
          "sscc": {
            "type": [
              "string",
              "null"
            ],
            "description": "SSCC-18 marked on the carton's GS1-128 label."
          }
        }
      },
      "SlipLine": {
        "type": "object",
        "description": "A single packed line on the slip.",
        "required": [
          "sku",
          "sku_qualifier",
          "quantity",
          "uom"
        ],
        "properties": {
          "quantity": {
            "type": "string"
          },
          "sku": {
            "type": "string"
          },
          "sku_qualifier": {
            "type": "string"
          },
          "uom": {
            "type": "string"
          }
        }
      },
      "SlipOrder": {
        "type": "object",
        "description": "The packed contents under one purchase order.",
        "required": [
          "po_number",
          "cartons"
        ],
        "properties": {
          "cartons": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SlipCarton"
            },
            "description": "Cartons when the ASN is carton-level; otherwise a single synthetic\ncarton with `sscc: None` holding the order-level items."
          },
          "po_number": {
            "type": "string"
          }
        }
      },
      "SsccAllocateRequest": {
        "type": "object",
        "description": "Body of `POST /v1/sscc/allocate`.",
        "required": [
          "count"
        ],
        "properties": {
          "company_prefix": {
            "type": [
              "string",
              "null"
            ],
            "description": "GS1 company prefix to allocate under. Defaults to the configured\n`EDI_GS1_COMPANY_PREFIX`; each (tenant, prefix) has its own counter."
          },
          "count": {
            "type": "integer",
            "format": "int32",
            "description": "How many SSCC-18s to allocate (1\u20131000).",
            "minimum": 0
          }
        }
      },
      "StatusBoardEntry": {
        "type": "object",
        "description": "One partner's operational health summary.",
        "required": [
          "partner_id",
          "partner_name",
          "documents_total",
          "inbound",
          "outbound",
          "accepted",
          "rejected",
          "sent",
          "overdue_acks",
          "open_exceptions",
          "health"
        ],
        "properties": {
          "accepted": {
            "type": "integer",
            "minimum": 0
          },
          "compliance_rate": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int32",
            "description": "Accepted \u00f7 (accepted + rejected), as a percentage 0\u2013100. `None` when no\ndocument has a definitive accept/reject verdict yet.",
            "minimum": 0
          },
          "documents_total": {
            "type": "integer",
            "minimum": 0
          },
          "health": {
            "type": "string",
            "description": "Overall health: `healthy`, `attention`, `idle`."
          },
          "inbound": {
            "type": "integer",
            "minimum": 0
          },
          "last_activity": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "Most recent document activity, if any."
          },
          "open_exceptions": {
            "type": "integer",
            "description": "Open exceptions needing operator attention (rejections + overdue acks).",
            "minimum": 0
          },
          "outbound": {
            "type": "integer",
            "minimum": 0
          },
          "overdue_acks": {
            "type": "integer",
            "description": "Outbound documents still awaiting a partner 997 past the ack SLA.",
            "minimum": 0
          },
          "partner_id": {
            "type": "string"
          },
          "partner_name": {
            "type": "string"
          },
          "rejected": {
            "type": "integer",
            "minimum": 0
          },
          "sent": {
            "type": "integer",
            "minimum": 0
          }
        }
      },
      "Subscriber": {
        "type": "object",
        "required": [
          "first_name",
          "last_name",
          "member_id"
        ],
        "properties": {
          "date_of_birth": {
            "type": [
              "string",
              "null"
            ],
            "format": "date",
            "description": "DMG02 \u2014 date of birth."
          },
          "first_name": {
            "type": "string"
          },
          "gender": {
            "type": [
              "string",
              "null"
            ],
            "description": "DMG03 \u2014 `M` / `F` / `U`."
          },
          "last_name": {
            "type": "string"
          },
          "member_id": {
            "type": "string",
            "description": "NM109 \u2014 member identification number (qualifier MI)."
          }
        }
      },
      "SyncOutcomeResponse": {
        "type": "object",
        "required": [
          "success",
          "data"
        ],
        "properties": {
          "data": {
            "$ref": "#/components/schemas/SyncOutcomeView"
          },
          "success": {
            "type": "boolean"
          }
        }
      },
      "SyncOutcomeView": {
        "type": "object",
        "required": [
          "event_id",
          "environment",
          "sync_status",
          "event_type",
          "observation_status"
        ],
        "properties": {
          "checked_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "connection_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "environment": {
            "type": "string"
          },
          "error_code": {
            "type": [
              "string",
              "null"
            ]
          },
          "event_id": {
            "type": "string"
          },
          "event_type": {
            "type": "string"
          },
          "observation_status": {
            "type": "string",
            "description": "current, stale, checking, unavailable, or awaiting_sync."
          },
          "observed_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "order": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/OrderObservation"
              },
              {
                "type": "null"
              }
            ]
          },
          "sync_action": {
            "type": [
              "string",
              "null"
            ]
          },
          "sync_status": {
            "type": "string"
          }
        }
      },
      "Tenant": {
        "type": "object",
        "description": "A tenant \u2014 an isolated namespace for partners and the documents they\nexchange. Provisioned by the dashboard gateway (one per WorkOS organization)\nor via the admin API.",
        "required": [
          "id",
          "display_name"
        ],
        "properties": {
          "created_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "display_name": {
            "type": "string"
          },
          "enabled": {
            "type": "boolean"
          },
          "id": {
            "type": "string",
            "description": "Stable tenant identifier (slug), e.g. `acme-com`."
          }
        }
      },
      "TenantApiKeyView": {
        "type": "object",
        "description": "The client-safe projection of a [`TenantApiKey`] \u2014 everything but the hash.",
        "required": [
          "id",
          "tenant_id",
          "name",
          "key_prefix",
          "created_by",
          "scopes",
          "created_at"
        ],
        "properties": {
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "created_by": {
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "key_prefix": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "scopes": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "tenant_id": {
            "type": "string"
          }
        }
      },
      "Tender204": {
        "type": "object",
        "required": [
          "shipment_id",
          "carrier_scac",
          "orders"
        ],
        "properties": {
          "bol_number": {
            "type": [
              "string",
              "null"
            ],
            "description": "L11*BM \u2014 bill of lading number."
          },
          "carrier_scac": {
            "type": "string",
            "description": "B202 \u2014 Standard Carrier Alpha Code of the tendered carrier."
          },
          "orders": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TenderOrder"
            }
          },
          "payment_method": {
            "type": [
              "string",
              "null"
            ],
            "description": "B206 \u2014 method of payment: `PP` prepaid (default), `CC` collect."
          },
          "pickup_date": {
            "type": [
              "string",
              "null"
            ],
            "format": "date",
            "description": "G62*69 \u2014 requested pickup date."
          },
          "ship_from": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/Party"
              },
              {
                "type": "null"
              }
            ]
          },
          "ship_to": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/Party"
              },
              {
                "type": "null"
              }
            ]
          },
          "shipment_id": {
            "type": "string",
            "description": "B204 \u2014 shipment identification (the carrier echoes it in the 990/214)."
          },
          "weight": {
            "type": [
              "string",
              "null"
            ],
            "description": "AT803 \u2014 total shipment weight."
          },
          "weight_uom": {
            "type": [
              "string",
              "null"
            ],
            "description": "AT802 \u2014 weight unit (default `L` pounds)."
          }
        }
      },
      "TenderOrder": {
        "type": "object",
        "required": [
          "po_number",
          "quantity"
        ],
        "properties": {
          "po_number": {
            "type": "string",
            "description": "OID02 \u2014 the purchase order this freight covers."
          },
          "quantity": {
            "type": "string",
            "description": "OID04 \u2014 number of units."
          },
          "weight": {
            "type": [
              "string",
              "null"
            ],
            "description": "OID05/OID06 \u2014 weight, when given per order."
          }
        }
      },
      "TestCase": {
        "type": "object",
        "description": "One certification case: a sample interchange and the outcome the partner's\nimplementation guide requires for it.",
        "required": [
          "name",
          "raw",
          "expect_valid"
        ],
        "properties": {
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "direction": {
            "$ref": "#/components/schemas/CaseDirection",
            "description": "Defaults to inbound. Outbound checks validate supplied wire files only;\nthey do not compare quantities to stored orders or send documents."
          },
          "expect_valid": {
            "type": "boolean",
            "description": "Whether the guide expects this interchange to validate clean. A negative\ncase (`false`) certifies that the partner's rules *reject* a malformed or\nnon-compliant document \u2014 not just that good documents pass."
          },
          "expected_rejection": {
            "type": [
              "string",
              "null"
            ],
            "description": "Optional case-sensitive substring required in the rejection detail.\nOnly valid for negative cases; prevents rejection for an unrelated cause\nfrom satisfying a guide-specific qualification case."
          },
          "name": {
            "type": "string"
          },
          "raw": {
            "type": "string",
            "description": "Raw inbound X12/EDIFACT or outbound X12 interchange to validate."
          },
          "transaction_set": {
            "type": [
              "string",
              "null"
            ],
            "description": "Required for outbound cases: 855, 856 or 810. Omit for inbound cases."
          }
        },
        "additionalProperties": false
      },
      "TestPack": {
        "type": "object",
        "description": "A named collection of certification cases for a partner.",
        "required": [
          "name",
          "cases"
        ],
        "properties": {
          "cases": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TestCase"
            }
          },
          "name": {
            "type": "string"
          }
        },
        "additionalProperties": false
      },
      "TextItem": {
        "type": "object",
        "properties": {
          "body": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "MSG01 free-form text lines, in order."
          },
          "reference": {
            "type": [
              "string",
              "null"
            ],
            "description": "MIT01 \u2014 message reference identification."
          },
          "subject": {
            "type": [
              "string",
              "null"
            ],
            "description": "MIT02 \u2014 subject of this message."
          }
        }
      },
      "TextMessage864": {
        "type": "object",
        "required": [
          "messages"
        ],
        "properties": {
          "description": {
            "type": [
              "string",
              "null"
            ],
            "description": "BMG02 \u2014 overall description / subject of the message."
          },
          "messages": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TextItem"
            }
          },
          "purpose": {
            "type": [
              "string",
              "null"
            ],
            "description": "BMG01 \u2014 transaction set purpose code."
          },
          "type_code": {
            "type": [
              "string",
              "null"
            ],
            "description": "BMG03 \u2014 transaction type code."
          }
        }
      },
      "TradingPartner": {
        "type": "object",
        "required": [
          "id",
          "name",
          "partner_isa_qualifier",
          "partner_isa_id",
          "our_isa_qualifier",
          "our_isa_id"
        ],
        "properties": {
          "ack_sla_hours": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int32",
            "description": "Per-partner acknowledgment SLA in hours. Strict retailers chargeback on\nlate 997s, so this overrides the global `EDI_ACK_SLA_HOURS` for monitoring\nand alerting. `None` falls back to the global SLA.",
            "minimum": 0
          },
          "ack_type": {
            "type": "string",
            "description": "Which functional acknowledgment this partner receives: `997` (default)\nor `999` (Implementation Acknowledgment with IK3/IK4 error detail)."
          },
          "api_key_hash": {
            "type": [
              "string",
              "null"
            ],
            "description": "SHA-256 hex of this partner's API key, set via\n`POST /v1/partners/:id/api-key`. The plaintext key is never stored."
          },
          "as1": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/As1Config",
                "description": "AS1 (EDI-over-email) settings \u2014 outbound documents are emailed to this\npartner as `application/edi-x12` attachments via stateset-mail."
              },
              {
                "type": "null"
              }
            ]
          },
          "as2": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/As2Config",
                "description": "AS2 transport settings, when this partner exchanges over AS2 rather than\n(or in addition to) file drop."
              },
              {
                "type": "null"
              }
            ]
          },
          "auto_ack_855": {
            "$ref": "#/components/schemas/AutoAck855",
            "description": "Automatic 855 acknowledgment of accepted inbound 850s: `off` (default)\nor `accept_all` (855 AC with every line IA, dispatched after the\ninbound commit; failures never fail the inbound document)."
          },
          "delimiters": {
            "$ref": "#/components/schemas/Delimiters"
          },
          "enforce_business_po_identity": {
            "type": "boolean",
            "description": "Reject a second original 850 for the same business PO, even with new\ncontrol numbers. PostgreSQL retains this identity beyond document expiry."
          },
          "id": {
            "type": "string",
            "description": "Stable internal identifier, used in URLs and event payloads."
          },
          "label": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/LabelProfile",
                "description": "Label placement profile (size, darkness, required mark) for this partner's\nGS1/UCC-128 labels. `None` falls back to a generic 4\u00d76\" thermal label."
              },
              {
                "type": "null"
              }
            ]
          },
          "name": {
            "type": "string"
          },
          "our_gs_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "our_isa_id": {
            "type": "string"
          },
          "our_isa_qualifier": {
            "type": "string",
            "description": "Our ISA qualifier/ID for this relationship."
          },
          "outbound_compliance": {
            "$ref": "#/components/schemas/OutboundCompliance",
            "description": "Pre-send compliance gate for outbound 855/856/810 checked against the\nstored 850 (+860 changes): `off`, `warn` (default \u2014 send and report the\nissues), or `block` (refuse with 422 when any error-level issue exists)."
          },
          "overlay": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/PartnerOverlay",
                "description": "Outbound companion-guide overlay \u2014 partner-specific segment/element\ntweaks applied to generated X12, so a partner's quirks are configuration,\nnot code. `None`/empty leaves documents untouched."
              },
              {
                "type": "null"
              }
            ]
          },
          "packing_slip": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/PackingSlipProfile",
                "description": "Packing-slip presentation overlay (seller name, logo line, footer marks,\nSSCC display). `None` falls back to a generic slip keyed off the\npartner's name."
              },
              {
                "type": "null"
              }
            ]
          },
          "partner_gs_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "GS application codes; default to the ISA IDs when omitted."
          },
          "partner_isa_id": {
            "type": "string"
          },
          "partner_isa_qualifier": {
            "type": "string",
            "description": "The partner's ISA qualifier/ID (they are the receiver on our outbound)."
          },
          "require_asn_ack_before_invoice": {
            "type": "boolean",
            "description": "Require accepted functional acknowledgments for every recorded ASN\nbefore accepting invoice documents/events. Set from the agreed guide."
          },
          "require_retail_v1": {
            "type": "boolean",
            "description": "Require explicit retail-v1 source facts for new ERP events. Previously\naccepted requests still replay their original receipt after enabling it."
          },
          "retail_closure_policy": {
            "$ref": "#/components/schemas/RetailClosurePolicy",
            "description": "Opt-in review of fully rejected or cancelled orders with no fulfillment.\nDoes not assert financial settlement or retailer business acceptance."
          },
          "retailer_profile": {
            "type": [
              "string",
              "null"
            ],
            "description": "Built-in retailer profile key (e.g. `walmart`, `qvc-rithum`) whose\noutbound rules the pre-send compliance check also enforces."
          },
          "tenant_id": {
            "type": "string",
            "description": "Owning tenant. Every partner belongs to exactly one tenant; an API key\nissued for the partner therefore implies its tenant. Defaults to\n`default` so single-tenant deployments and pre-tenancy records work\nunchanged."
          },
          "usage": {
            "type": "string",
            "description": "ISA15 usage indicator: `P` production, `T` test."
          },
          "validation": {
            "$ref": "#/components/schemas/PartnerValidation",
            "description": "Optional inbound validation rules \u2014 a subset of a partner's EDI\nimplementation guide, enforced before translation."
          },
          "van": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/VanConfig",
                "description": "StateSet Network / VAN mailbox settings. This is our native managed EDI\nnetwork rail: outbound files are dropped into the partner mailbox and\ninbound files are polled from it."
              },
              {
                "type": "null"
              }
            ]
          },
          "version": {
            "type": "string",
            "description": "GS08 version, e.g. `004010`."
          }
        }
      },
      "Transfer943": {
        "type": "object",
        "required": [
          "shipment_id",
          "transfer_number",
          "ship_date",
          "items"
        ],
        "properties": {
          "carrier_scac": {
            "type": [
              "string",
              "null"
            ],
            "description": "W2702 \u2014 carrier SCAC."
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TransferItem"
            }
          },
          "ship_date": {
            "type": "string",
            "format": "date",
            "description": "W0603 / G62*11 \u2014 ship date."
          },
          "ship_from": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/Party"
              },
              {
                "type": "null"
              }
            ]
          },
          "ship_to": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/Party",
                "description": "The destination warehouse."
              },
              {
                "type": "null"
              }
            ]
          },
          "shipment_id": {
            "type": "string",
            "description": "W0604 \u2014 the shipment identification for this transfer."
          },
          "transfer_number": {
            "type": "string",
            "description": "W0602 \u2014 depositor (our) order/transfer number."
          }
        }
      },
      "TransferItem": {
        "type": "object",
        "required": [
          "quantity",
          "sku"
        ],
        "properties": {
          "quantity": {
            "type": "string"
          },
          "sku": {
            "type": "string"
          },
          "sku_qualifier": {
            "type": "string",
            "description": "W0404 identifier qualifier (SK / VN / UP)."
          },
          "uom": {
            "type": "string"
          }
        }
      },
      "TxAck": {
        "type": "object",
        "required": [
          "tx_id",
          "control_number",
          "status"
        ],
        "properties": {
          "control_number": {
            "type": "string"
          },
          "error_codes": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "AK502-AK506 (IK502-IK506): the partner's transaction-level reasons."
          },
          "segment_errors": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SegmentError"
            },
            "description": "AK3/AK4 (IK3/IK4): where in our document the partner found errors."
          },
          "status": {
            "type": "string",
            "description": "AK501."
          },
          "tx_id": {
            "type": "string",
            "description": "AK201 / AK202."
          }
        }
      },
      "UblInvoiceInput": {
        "type": "object",
        "description": "The canonical input for a Peppol-BIS invoice.",
        "required": [
          "invoice_number",
          "issue_date",
          "supplier",
          "customer",
          "lines"
        ],
        "properties": {
          "buyer_reference": {
            "type": [
              "string",
              "null"
            ]
          },
          "currency": {
            "type": "string",
            "description": "ISO 4217 currency, e.g. `EUR`."
          },
          "customer": {
            "$ref": "#/components/schemas/EInvoiceParty"
          },
          "due_date": {
            "type": [
              "string",
              "null"
            ]
          },
          "invoice_number": {
            "type": "string"
          },
          "issue_date": {
            "type": "string",
            "description": "ISO date `YYYY-MM-DD`."
          },
          "lines": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/UblLine"
            }
          },
          "supplier": {
            "$ref": "#/components/schemas/EInvoiceParty"
          },
          "tax_percent": {
            "type": "string",
            "description": "Single VAT rate (percent) applied to the whole invoice \u2014 the common case;\nmulti-rate breakdown is a later refinement."
          }
        }
      },
      "UblLine": {
        "type": "object",
        "description": "One invoice line.",
        "required": [
          "description",
          "quantity",
          "unit_price"
        ],
        "properties": {
          "description": {
            "type": "string"
          },
          "quantity": {
            "type": "string"
          },
          "unit_price": {
            "type": "string"
          },
          "uom": {
            "type": "string"
          }
        }
      },
      "UblTotals": {
        "type": "object",
        "description": "Computed monetary totals for the invoice.",
        "required": [
          "line_extension",
          "tax_exclusive",
          "tax_amount",
          "tax_inclusive",
          "payable"
        ],
        "properties": {
          "line_extension": {
            "type": "string"
          },
          "payable": {
            "type": "string"
          },
          "tax_amount": {
            "type": "string"
          },
          "tax_exclusive": {
            "type": "string"
          },
          "tax_inclusive": {
            "type": "string"
          }
        }
      },
      "UsageRecord": {
        "type": "object",
        "description": "One billable action.",
        "required": [
          "id",
          "tenant_id",
          "kind",
          "quantity",
          "occurred_at"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "description": "`document_inbound`, `document_outbound`, or `delivery_attempt`."
          },
          "occurred_at": {
            "type": "string",
            "format": "date-time"
          },
          "partner_id": {
            "type": "string"
          },
          "quantity": {
            "type": "integer",
            "format": "int64"
          },
          "tenant_id": {
            "type": "string"
          },
          "transaction_set": {
            "type": "string"
          }
        }
      },
      "UsageSummary": {
        "type": "object",
        "description": "Aggregated consumption for a tenant over a period.",
        "required": [
          "tenant_id",
          "total",
          "by_kind",
          "by_transaction_set",
          "by_partner"
        ],
        "properties": {
          "by_kind": {
            "type": "object",
            "description": "Totals per action kind.",
            "additionalProperties": {
              "type": "integer",
              "format": "int64"
            },
            "propertyNames": {
              "type": "string"
            }
          },
          "by_partner": {
            "type": "object",
            "description": "Totals per partner.",
            "additionalProperties": {
              "type": "integer",
              "format": "int64"
            },
            "propertyNames": {
              "type": "string"
            }
          },
          "by_transaction_set": {
            "type": "object",
            "description": "Totals per transaction set (documents only).",
            "additionalProperties": {
              "type": "integer",
              "format": "int64"
            },
            "propertyNames": {
              "type": "string"
            }
          },
          "tenant_id": {
            "type": "string"
          },
          "total": {
            "type": "integer",
            "format": "int64"
          }
        }
      },
      "ValidationIssue": {
        "type": "object",
        "description": "One implementation-guide violation, carrying everything a 999 IK3/IK4 (or\nan operator fixing the file) needs to pinpoint it: which segment, where in\nthe transaction, which element, and the offending value.",
        "required": [
          "code",
          "message"
        ],
        "properties": {
          "code": {
            "type": "string",
            "description": "Stable machine code: `set_not_accepted`, `missing_segment`,\n`missing_reference`, `missing_element`, `value_not_allowed`,\n`too_short`, `too_long`, `too_few`, `too_many`,\n`missing_qualified_segment`, `count_mismatch`, `bad_format`, or\n`condition_failed`."
          },
          "component": {
            "type": [
              "integer",
              "null"
            ],
            "description": "1-based component selected by an element rule. EDIFACT defaults to 1;\nomitted for whole X12 elements and legacy findings without this detail.",
            "minimum": 1
          },
          "element": {
            "type": [
              "integer",
              "null"
            ],
            "description": "1-based element position (999 IK4-01 numbering).",
            "minimum": 0
          },
          "message": {
            "type": "string"
          },
          "recorded_severity": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/RecordedSeverity",
                "description": "Original compliance severity at generation time, when recorded. Older\nrecords and inbound guide findings omit this field. It does not prove\nthat sending was blocked or that a generated document was delivered."
              },
              {
                "type": "null"
              }
            ]
          },
          "segment": {
            "type": "string",
            "description": "Segment tag the issue is about (empty for set-level issues)."
          },
          "segment_position": {
            "type": [
              "integer",
              "null"
            ],
            "description": "1-based position counting ST (X12, 999 IK3-02) or UNH (EDIFACT) as 1.\nAbsent when the segment is missing entirely.",
            "minimum": 0
          },
          "value": {
            "type": [
              "string",
              "null"
            ],
            "description": "The offending value, when one is present."
          }
        }
      },
      "ValidationReport": {
        "type": "object",
        "description": "Validation report for a dry run \u2014 what inbound processing *would* accept or\nreject, with no side effects.",
        "required": [
          "partner_id",
          "interchange_control_number",
          "valid",
          "documents"
        ],
        "properties": {
          "documents": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DocumentValidation"
            }
          },
          "interchange_acknowledgments": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InterchangeAcknowledgment"
            }
          },
          "interchange_control_number": {
            "type": "string"
          },
          "partner_id": {
            "type": "string"
          },
          "structural_error": {
            "type": [
              "string",
              "null"
            ],
            "description": "Set when the envelope itself is invalid (no per-document results then)."
          },
          "valid": {
            "type": "boolean",
            "description": "True when the interchange contains accepted X12 transactions, EDIFACT\nmessages, or valid TA1 acknowledgments. This is dry-run validation,\nnot evidence of processing, acknowledgment settlement, or delivery."
          }
        }
      },
      "VanConfig": {
        "type": "object",
        "required": [
          "mailbox"
        ],
        "properties": {
          "mailbox": {
            "type": "string",
            "description": "Mailbox slug under the provider."
          },
          "provider": {
            "type": "string",
            "description": "`stateset-network` for our native managed network, or an interconnect\nkey such as `sps-commerce` when a bridge is configured."
          }
        }
      },
      "WorkspaceSetup": {
        "type": "object",
        "required": [
          "name"
        ],
        "properties": {
          "name": {
            "type": "string"
          }
        }
      }
    },
    "securitySchemes": {
      "bearer": {
        "type": "http",
        "scheme": "bearer",
        "description": "Admin token (EDI_API_TOKEN) or a partner API key"
      }
    }
  },
  "security": [
    {
      "bearer": []
    }
  ],
  "tags": [
    {
      "name": "system",
      "description": "Health and metrics"
    },
    {
      "name": "partners",
      "description": "Trading partner registry and credentials"
    },
    {
      "name": "inbound",
      "description": "Inbound EDI processing"
    },
    {
      "name": "outbound",
      "description": "Outbound EDI generation"
    },
    {
      "name": "operations",
      "description": "Outbox, audit log, debugging"
    }
  ],
  "x-stateset-provenance": {
    "reviewed_at": "2026-10-20",
    "repository": "stateset-edi",
    "revision": "3f6b5c03e5388f87da765c3d13437ff6e4d61220",
    "source": "docs/openapi.json, byte-identical to the offline examples/openapi exporter",
    "scope": "202 documented operations; a source contract does not by itself establish hosted feature availability."
  }
}
