{
  "openapi": "3.1.0",
  "info": {
    "title": "YLOAD Engine API",
    "version": "0.2.0",
    "description": "Read and write access to one YLOAD workspace for your own systems.\n\n**Keys.** A company admin creates a key in Settings → API Keys; it is shown once. Send it as `X-API-Key: <key>` or `Authorization: Bearer <key>`. A key reaches only its own workspace, through the same access rules YLOAD applies to its users, and every call made with it is audited. Revoked or expired keys get 401.\n\n**Scopes.** Every key has `read`. Buy-side money (charge cost, creditor, AP status, quote buy total and margin) is returned only to keys that also carry `finance:cost`; without it those fields are absent, not null. Writes need `write:sales` (customers, quotes), `write:operations` (shipments, milestones, documents, carrier, dispatch, close) or `write:finance` (charges); each operation names its scopes in `x-yload-scope`.\n\n**Pagination.** Lists are ordered by `updated_at`, then `id`, oldest first. `limit` is 100 by default, at most 500. Pass `page.next_cursor` back as `cursor` while `page.has_more` is true.\n\n**Incremental pulls.** `updated_since` (inclusive) returns rows changed at or after a time. Or keep the last `next_cursor`: asking again later with it returns only rows changed since. A row changed by a transaction that was still open while you read can be missed, so re-read with a few minutes of overlap — or follow `GET /v1/events`.\n\n**Writes.** Every write needs an `Idempotency-Key` header, unique per request. Retrying with the same key returns the first answer (with `Idempotent-Replayed: true`) and changes nothing; the same key with a different request is refused (`idempotency_key_reused`); a request that failed did not use up its key. Each write runs in one transaction under YLOAD's own rules (numbering, totals, status rules) and records an audit row and an event. A write to a module the workspace has not enabled is refused with `module_not_enabled`.\n\n**Confirmation classes** (`x-yload-confirmation-class`). `automatic`: done at once. `confirm`: the call answers 202 with a confirmation, and nothing happens until `POST /v1/confirmations/{id}/confirm` (within 24 hours). `human`: as `confirm`, but first a YLOAD user who did not issue the requesting key approves it in Settings → API Keys (within 168 hours) — for actions that move money and for closing a file.\n\n**Events.** `GET /v1/events` lists what changed, in commit order, with a cursor that never skips: keep `page.next_cursor` and ask again. Changes made through the API carry `source: engine_api`; shipments, milestones, charges, documents and legs changed in YLOAD itself carry `source: yload_app` — and so do quotes (`quote.created` / `updated` / `status_changed` / `deleted`), parties (`party.created` / `updated` / `deleted`) and invoices (`invoice.created` / `updated` / `status_changed` / `deleted`), which this feed carries but outbound endpoints do not push (a pushed message is a shipment). Events name records and states, not amounts; read the record for its details.\n\n**Outbound messages** (`webhooks.shipmentMessage`). YLOAD can also push: a company admin adds an endpoint in Settings → Webhooks and chooses which events send the complete shipment there. Each message is an HTTPS POST of one document — JSON, or the same document as XML if the endpoint is set to XML — signed (`X-Yload-Signature: t=<unix seconds>,v1=<hex HMAC-SHA256 of \"<t>.<body>\" with the endpoint's secret>`), with `Idempotency-Key` = the event id. Delivery is at least once and in order per endpoint: answer 2xx to accept; anything else, or no answer in 10 seconds, is retried with exponential backoff (30 s up to 15 min) and later messages wait behind it, until the endpoint's attempt limit dead-letters it. `event.seq` numbers the workspace's events, `event.shipment_seq` the messages about one shipment to this endpoint (no gaps unless a message was dead-lettered). A resend from the transmission log repeats a message byte for byte, with the same event id.\n\n**Rate limit.** Per key, per minute (120 by default). The `X-RateLimit-*` headers report it; over the limit you get 429 with `Retry-After`.\n\n**Versioning and change notice.** The path carries the major version (`/v1`). Additions — a new endpoint, a new field in a response, a new event or message field — can ship in any release, so ignore fields you do not know. Removing or renaming a field, changing its type or meaning, or retiring an endpoint is a breaking change: it is announced under What's new in YLOAD (`/app/whats-new`) and by e-mail to each workspace's administrators at least 60 days before it takes effect, and a release that contains one is refused until that notice has run. The same rule covers the outbound messages and the data export. Every release is listed under What's new with what it changes."
  },
  "servers": [
    {
      "url": "https://zzhlnrbmcdefzlpcygof.supabase.co/functions/v1/engine-api"
    }
  ],
  "security": [
    {
      "apiKey": []
    },
    {
      "bearer": []
    }
  ],
  "tags": [
    {
      "name": "Shipments",
      "description": "Shipments of every mode, their legs and milestones."
    },
    {
      "name": "Finance",
      "description": "Charges and invoices."
    },
    {
      "name": "Parties",
      "description": "Customers, suppliers and carriers."
    },
    {
      "name": "Sales",
      "description": "Quotes."
    },
    {
      "name": "Documents",
      "description": "Document metadata and uploads."
    },
    {
      "name": "Events",
      "description": "The change feed."
    },
    {
      "name": "Confirmations",
      "description": "Requests parked until they are confirmed or approved."
    },
    {
      "name": "Meta",
      "description": "About the API itself."
    }
  ],
  "paths": {
    "/v1/openapi.json": {
      "get": {
        "tags": [
          "Meta"
        ],
        "operationId": "getOpenApi",
        "summary": "This document",
        "security": [],
        "responses": {
          "200": {
            "description": "The OpenAPI 3.1 document.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/v1/shipments": {
      "get": {
        "tags": [
          "Shipments"
        ],
        "operationId": "listShipments",
        "summary": "List shipments",
        "description": "Shipments of every transport mode in one shape. Fields a mode does not record are null.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Cursor"
          },
          {
            "$ref": "#/components/parameters/UpdatedSince"
          },
          {
            "$ref": "#/components/parameters/IncludeDeleted"
          },
          {
            "name": "mode",
            "in": "query",
            "required": false,
            "description": "Only rows of this transport mode.",
            "schema": {
              "type": "string",
              "enum": [
                "sea",
                "air",
                "road",
                "rail",
                "breakbulk",
                "multimodal"
              ]
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "description": "Only shipments with this status (as recorded by the mode).",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "reference",
            "in": "query",
            "required": false,
            "description": "Only the shipment with this file reference.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "One page, oldest change first.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "page"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Shipment"
                      }
                    },
                    "page": {
                      "$ref": "#/components/schemas/Page"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      },
      "post": {
        "tags": [
          "Shipments"
        ],
        "operationId": "createShipment",
        "summary": "Create a shipment",
        "description": "Creates a road, sea or air file as Draft, in one transaction, with what a file created in YLOAD starts with: its automatic tasks, its milestones and (road, air) its File Close checklist. YLOAD assigns the reference.",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateShipmentRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Done. A replay of the same Idempotency-Key returns this answer again.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreateShipmentResult"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/Unprocessable"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "x-yload-scope": [
          "write:operations"
        ],
        "x-yload-confirmation-class": "automatic",
        "x-yload-modules": [
          "the shipment's mode"
        ],
        "x-yload-event": "shipment.created"
      }
    },
    "/v1/shipments/{id}": {
      "get": {
        "tags": [
          "Shipments"
        ],
        "operationId": "getShipment",
        "summary": "Get one shipment",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The shipment.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Shipment"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/v1/legs": {
      "get": {
        "tags": [
          "Shipments"
        ],
        "operationId": "listLegs",
        "summary": "List shipment legs",
        "description": "Legs of every mode. Sea and air legs are the positions of the file's routing; their id is derived from (mode, shipment, position), so it changes meaning if a leg is inserted before it.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Cursor"
          },
          {
            "$ref": "#/components/parameters/UpdatedSince"
          },
          {
            "name": "mode",
            "in": "query",
            "required": false,
            "description": "Only rows of this transport mode.",
            "schema": {
              "type": "string",
              "enum": [
                "sea",
                "air",
                "road",
                "rail",
                "breakbulk",
                "multimodal"
              ]
            }
          },
          {
            "name": "shipment_id",
            "in": "query",
            "required": false,
            "description": "Only rows of this shipment.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "One page, oldest change first.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "page"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Leg"
                      }
                    },
                    "page": {
                      "$ref": "#/components/schemas/Page"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/v1/milestones": {
      "get": {
        "tags": [
          "Shipments"
        ],
        "operationId": "listMilestones",
        "summary": "List milestones",
        "description": "Milestones of sea, air, road, rail and multimodal shipments.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Cursor"
          },
          {
            "$ref": "#/components/parameters/UpdatedSince"
          },
          {
            "name": "mode",
            "in": "query",
            "required": false,
            "description": "Only rows of this transport mode.",
            "schema": {
              "type": "string",
              "enum": [
                "sea",
                "air",
                "road",
                "rail",
                "breakbulk",
                "multimodal"
              ]
            }
          },
          {
            "name": "shipment_id",
            "in": "query",
            "required": false,
            "description": "Only rows of this shipment.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "One page, oldest change first.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "page"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Milestone"
                      }
                    },
                    "page": {
                      "$ref": "#/components/schemas/Page"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/v1/charges": {
      "get": {
        "tags": [
          "Finance"
        ],
        "operationId": "listCharges",
        "summary": "List charges",
        "description": "Charge lines of every mode. Buy-side fields (cost, creditor, AP status) are returned only to keys with the finance:cost scope.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Cursor"
          },
          {
            "$ref": "#/components/parameters/UpdatedSince"
          },
          {
            "name": "mode",
            "in": "query",
            "required": false,
            "description": "Only rows of this transport mode.",
            "schema": {
              "type": "string",
              "enum": [
                "sea",
                "air",
                "road",
                "rail",
                "breakbulk",
                "multimodal"
              ]
            }
          },
          {
            "name": "shipment_id",
            "in": "query",
            "required": false,
            "description": "Only rows of this shipment.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "One page, oldest change first.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "page"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Charge"
                      }
                    },
                    "page": {
                      "$ref": "#/components/schemas/Page"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/v1/invoices": {
      "get": {
        "tags": [
          "Finance"
        ],
        "operationId": "listInvoices",
        "summary": "List invoices",
        "description": "Customer invoices, proformas and credit notes from the finance ledger.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Cursor"
          },
          {
            "$ref": "#/components/parameters/UpdatedSince"
          },
          {
            "name": "mode",
            "in": "query",
            "required": false,
            "description": "Only rows of this transport mode.",
            "schema": {
              "type": "string",
              "enum": [
                "sea",
                "air",
                "road",
                "rail",
                "breakbulk",
                "multimodal"
              ]
            }
          },
          {
            "name": "shipment_id",
            "in": "query",
            "required": false,
            "description": "Only rows of this shipment.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "description": "Only invoices with this status.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "invoice_type",
            "in": "query",
            "required": false,
            "description": "final, proforma or credit_note.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "One page, oldest change first.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "page"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Invoice"
                      }
                    },
                    "page": {
                      "$ref": "#/components/schemas/Page"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/v1/invoices/{id}": {
      "get": {
        "tags": [
          "Finance"
        ],
        "operationId": "getInvoice",
        "summary": "Get one invoice",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The invoice.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Invoice"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/v1/parties": {
      "get": {
        "tags": [
          "Parties"
        ],
        "operationId": "listParties",
        "summary": "List parties",
        "description": "Customers, suppliers, carriers and other companies of the workspace.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Cursor"
          },
          {
            "$ref": "#/components/parameters/UpdatedSince"
          },
          {
            "$ref": "#/components/parameters/IncludeDeleted"
          }
        ],
        "responses": {
          "200": {
            "description": "One page, oldest change first.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "page"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Party"
                      }
                    },
                    "page": {
                      "$ref": "#/components/schemas/Page"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/v1/parties/{id}": {
      "get": {
        "tags": [
          "Parties"
        ],
        "operationId": "getParty",
        "summary": "Get one party",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The party.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Party"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/v1/quotes": {
      "get": {
        "tags": [
          "Sales"
        ],
        "operationId": "listQuotes",
        "summary": "List quotes",
        "description": "Customer quotes. Buy total and margin are returned only to keys with the finance:cost scope.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Cursor"
          },
          {
            "$ref": "#/components/parameters/UpdatedSince"
          },
          {
            "name": "mode",
            "in": "query",
            "required": false,
            "description": "Only rows of this transport mode.",
            "schema": {
              "type": "string",
              "enum": [
                "sea",
                "air",
                "road",
                "rail",
                "breakbulk",
                "multimodal"
              ]
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "description": "Only quotes with this status.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "party_id",
            "in": "query",
            "required": false,
            "description": "Only quotes of this customer.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "One page, oldest change first.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "page"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Quote"
                      }
                    },
                    "page": {
                      "$ref": "#/components/schemas/Page"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      },
      "post": {
        "tags": [
          "Sales"
        ],
        "operationId": "createQuote",
        "summary": "Create a quote with lines",
        "description": "Creates a draft quote for a customer of the workspace, with its lines, in one transaction. YLOAD numbers it and totals it; all lines must be in one currency.",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateQuoteRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Done. A replay of the same Idempotency-Key returns this answer again.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreateQuoteResult"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/Unprocessable"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "x-yload-scope": [
          "write:sales"
        ],
        "x-yload-confirmation-class": "automatic",
        "x-yload-modules": [
          "sales"
        ],
        "x-yload-event": "quote.created"
      }
    },
    "/v1/quotes/{id}": {
      "get": {
        "tags": [
          "Sales"
        ],
        "operationId": "getQuote",
        "summary": "Get one quote",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The quote.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Quote"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/v1/documents": {
      "get": {
        "tags": [
          "Documents"
        ],
        "operationId": "listDocuments",
        "summary": "List document metadata",
        "description": "Metadata of shipment documents. File contents are not served by this version.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Cursor"
          },
          {
            "$ref": "#/components/parameters/UpdatedSince"
          },
          {
            "name": "mode",
            "in": "query",
            "required": false,
            "description": "Only rows of this transport mode.",
            "schema": {
              "type": "string",
              "enum": [
                "sea",
                "air",
                "road",
                "rail",
                "breakbulk",
                "multimodal"
              ]
            }
          },
          {
            "name": "shipment_id",
            "in": "query",
            "required": false,
            "description": "Only rows of this shipment.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "One page, oldest change first.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "page"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Document"
                      }
                    },
                    "page": {
                      "$ref": "#/components/schemas/Page"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/v1/customers": {
      "post": {
        "tags": [
          "Parties"
        ],
        "operationId": "createCustomer",
        "summary": "Create a customer",
        "description": "Creates a customer party (CRM account) in the workspace. The account is owned by the workspace's API identity and recorded in its history like one created in YLOAD.",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateCustomerRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Done. A replay of the same Idempotency-Key returns this answer again.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreateCustomerResult"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/Unprocessable"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "x-yload-scope": [
          "write:sales"
        ],
        "x-yload-confirmation-class": "automatic",
        "x-yload-modules": [
          "sales"
        ],
        "x-yload-event": "party.created"
      }
    },
    "/v1/quotes/{id}/accept": {
      "post": {
        "tags": [
          "Sales"
        ],
        "operationId": "acceptQuote",
        "summary": "Accept a quote and create its shipment",
        "description": "Records the customer's acceptance and creates the shipment from the quote, seeded like a file created in YLOAD (tasks, milestones, File Close checklist), and marks the quote transferred. Two-phase: this call parks the request; POST /v1/confirmations/{id}/confirm carries it out. The quote's money lines are not copied to the shipment — charges come in through add_charge, which a person approves.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AcceptQuoteRequest"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Parked until confirmed: the confirmation to carry it out with. A replay of the same Idempotency-Key returns it again.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConfirmationAnswer"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/Unprocessable"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "x-yload-scope": [
          "write:sales",
          "write:operations"
        ],
        "x-yload-confirmation-class": "confirm",
        "x-yload-modules": [
          "sales",
          "the shipment's mode"
        ],
        "x-yload-event": "quote.accepted"
      }
    },
    "/v1/shipments/{id}/status": {
      "post": {
        "tags": [
          "Shipments"
        ],
        "operationId": "updateShipmentStatus",
        "summary": "Move a shipment's status forward",
        "description": "Sets the status, forward along the mode's chain only (or into and out of On Hold). Moving back, cancelling and reopening need a manager in YLOAD and are refused with manager_required. The mode's own required-field rules still apply.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateShipmentStatusRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done. A replay of the same Idempotency-Key returns this answer again.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UpdateShipmentStatusResult"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/Unprocessable"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "x-yload-scope": [
          "write:operations"
        ],
        "x-yload-confirmation-class": "automatic",
        "x-yload-modules": [
          "the shipment's mode"
        ],
        "x-yload-event": "shipment.status_changed"
      }
    },
    "/v1/shipments/{id}/milestones": {
      "post": {
        "tags": [
          "Shipments"
        ],
        "operationId": "addMilestone",
        "summary": "Add a milestone",
        "description": "Adds a milestone to a road, sea or air shipment. A key the shipment already has answers conflict.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AddMilestoneRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Done. A replay of the same Idempotency-Key returns this answer again.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AddMilestoneResult"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/Unprocessable"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "x-yload-scope": [
          "write:operations"
        ],
        "x-yload-confirmation-class": "automatic",
        "x-yload-modules": [
          "the shipment's mode"
        ],
        "x-yload-event": "milestone.added"
      }
    },
    "/v1/milestones/{id}/complete": {
      "post": {
        "tags": [
          "Shipments"
        ],
        "operationId": "completeMilestone",
        "summary": "Complete a milestone",
        "description": "Marks a milestone of a road, sea or air shipment completed. Completing a completed milestone changes nothing and answers its current state.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CompleteMilestoneRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done. A replay of the same Idempotency-Key returns this answer again.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CompleteMilestoneResult"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/Unprocessable"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "x-yload-scope": [
          "write:operations"
        ],
        "x-yload-confirmation-class": "automatic",
        "x-yload-modules": [
          "the shipment's mode"
        ],
        "x-yload-event": "milestone.completed"
      }
    },
    "/v1/shipments/{id}/documents": {
      "post": {
        "tags": [
          "Documents"
        ],
        "operationId": "uploadDocument",
        "summary": "Upload a document to a shipment",
        "description": "Stores a file on a road, sea or air shipment: the file goes to the workspace's private document store under the workspace's own prefix (as s3-presign does for the app), and the document row is written in the same transaction as the audit and event rows. At most 5 MB, sent base64-encoded.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UploadDocumentRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Done. A replay of the same Idempotency-Key returns this answer again.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UploadDocumentResult"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/Unprocessable"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "x-yload-scope": [
          "write:operations"
        ],
        "x-yload-confirmation-class": "automatic",
        "x-yload-modules": [
          "the shipment's mode"
        ],
        "x-yload-event": "document.uploaded"
      }
    },
    "/v1/shipments/{id}/carrier": {
      "post": {
        "tags": [
          "Shipments"
        ],
        "operationId": "assignCarrier",
        "summary": "Assign the carrier of a road shipment",
        "description": "Road only. Sets the shipment's carrier and issues the transport order on its movement, as Direct Assign does in YLOAD. No buy price: cost lines come in through add_charge.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AssignCarrierRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done. A replay of the same Idempotency-Key returns this answer again.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AssignCarrierResult"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/Unprocessable"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "x-yload-scope": [
          "write:operations"
        ],
        "x-yload-confirmation-class": "automatic",
        "x-yload-modules": [
          "the shipment's mode"
        ],
        "x-yload-event": "shipment.carrier_assigned"
      }
    },
    "/v1/shipments/{id}/dispatch": {
      "post": {
        "tags": [
          "Shipments"
        ],
        "operationId": "dispatchShipment",
        "summary": "Dispatch a road shipment",
        "description": "Road only. Dispatches the shipment's movements (carrier and transport order required), which records the truck_dispatched milestone. Two-phase: confirm with POST /v1/confirmations/{id}/confirm.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DispatchRequest"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Parked until confirmed: the confirmation to carry it out with. A replay of the same Idempotency-Key returns it again.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConfirmationAnswer"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/Unprocessable"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "x-yload-scope": [
          "write:operations"
        ],
        "x-yload-confirmation-class": "confirm",
        "x-yload-modules": [
          "the shipment's mode"
        ],
        "x-yload-event": "shipment.dispatched"
      }
    },
    "/v1/shipments/{id}/charges": {
      "post": {
        "tags": [
          "Finance"
        ],
        "operationId": "addCharge",
        "summary": "Add a charge to a shipment",
        "description": "Adds a revenue or cost line to a road, sea or air shipment as a draft. Moves money, so it is human-confirmed: the call parks the request, a YLOAD user who did not issue this key approves it in Settings → API Keys, then POST /v1/confirmations/{id}/confirm writes it. Cost lines need the finance:cost scope.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AddChargeRequest"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Parked until confirmed: the confirmation to carry it out with. A replay of the same Idempotency-Key returns it again.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConfirmationAnswer"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/Unprocessable"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "x-yload-scope": [
          "write:finance"
        ],
        "x-yload-confirmation-class": "human",
        "x-yload-modules": [
          "finance",
          "the shipment's mode"
        ],
        "x-yload-event": "charge.added"
      }
    },
    "/v1/shipments/{id}/close-request": {
      "post": {
        "tags": [
          "Shipments"
        ],
        "operationId": "requestClose",
        "summary": "Request that a shipment be closed",
        "description": "Asks the workspace to close a road, sea or air file. Human-confirmed: a YLOAD user who did not issue this key approves it; confirming then records that approval on the file's File Close checklist (\"Manager approval obtained\"). The close itself stays in YLOAD, where its blockers (documents, invoices, finance verification) are checked.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RequestCloseRequest"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Parked until confirmed: the confirmation to carry it out with. A replay of the same Idempotency-Key returns it again.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConfirmationAnswer"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/Unprocessable"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "x-yload-scope": [
          "write:operations"
        ],
        "x-yload-confirmation-class": "human",
        "x-yload-modules": [
          "the shipment's mode"
        ],
        "x-yload-event": "shipment.close_approved"
      }
    },
    "/v1/events": {
      "get": {
        "tags": [
          "Events"
        ],
        "operationId": "listEvents",
        "summary": "List events",
        "description": "What the API changed in this workspace, oldest first, numbered in commit order. Keep `page.next_cursor` and ask again for what happened since; an event that committed late is never skipped.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "description": "`page.next_cursor` of the previous page; from the beginning when left out.",
            "schema": {
              "type": "string",
              "pattern": "^[0-9]{1,15}$"
            }
          },
          {
            "name": "event_type",
            "in": "query",
            "required": false,
            "description": "Only events of this type, e.g. shipment.created.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "entity_type",
            "in": "query",
            "required": false,
            "description": "Only events about this kind of record, e.g. shipment.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "One page, in commit order.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "page"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Event"
                      }
                    },
                    "page": {
                      "$ref": "#/components/schemas/EventPage"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/v1/confirmations/{id}": {
      "get": {
        "tags": [
          "Confirmations"
        ],
        "operationId": "getConfirmation",
        "summary": "Get a confirmation",
        "description": "The state of a parked request: pending, approved (human class), rejected, executed (with its result) or expired.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The confirmation.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Confirmation"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/v1/confirmations/{id}/confirm": {
      "post": {
        "tags": [
          "Confirmations"
        ],
        "operationId": "confirm",
        "summary": "Carry out a parked request",
        "description": "Executes the request the confirmation holds, exactly as it was sent, in one transaction — a `confirm` request while pending, a `human` one once approved. Needs its own Idempotency-Key and a key of the same workspace with the operation's scopes. No body.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "200": {
            "description": "Done: the operation's own result.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "request_id",
                    "event_id"
                  ],
                  "properties": {
                    "data": {
                      "type": "object"
                    },
                    "request_id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "event_id": {
                      "type": "integer"
                    }
                  }
                }
              }
            }
          },
          "201": {
            "description": "Done, and it created a record: the operation's own result.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "request_id",
                    "event_id"
                  ],
                  "properties": {
                    "data": {
                      "type": "object"
                    },
                    "request_id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "event_id": {
                      "type": "integer"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/Unprocessable"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "x-yload-confirmation-class": "automatic",
        "x-yload-event": "the parked operation's event"
      }
    }
  },
  "webhooks": {
    "shipmentMessage": {
      "post": {
        "tags": [
          "Events"
        ],
        "operationId": "shipmentMessage",
        "summary": "Outbound shipment message",
        "description": "What YLOAD POSTs to an endpoint configured in Settings → Webhooks, once per matching event. Verify X-Yload-Signature, then answer 2xx; deduplicate by Idempotency-Key.",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "The event id. The same on every retry and on a resend.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Yload-Event-Id",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Yload-Event-Type",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Yload-Sequence",
            "in": "header",
            "required": true,
            "description": "event.seq.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Yload-Shipment-Sequence",
            "in": "header",
            "required": true,
            "description": "event.shipment_seq.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Yload-Delivery-Id",
            "in": "header",
            "required": true,
            "description": "This delivery; a resend has its own.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "X-Yload-Attempt",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Yload-Endpoint",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "X-Yload-Timestamp",
            "in": "header",
            "required": true,
            "description": "Unix seconds; part of the signed bytes.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Yload-Signature",
            "in": "header",
            "required": true,
            "description": "t=<unix seconds>,v1=<hex HMAC-SHA256(secret, \"<t>.<raw body>\")>.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "description": "JSON, or XML when the endpoint is set to XML: the same document, same schema version. XML rules: root <ShipmentMessage xmlns=\"https://yload.eu/schema/shipment-message/v1\" schema=\"yload.shipment-message.v1\">; each object member is an element named by its key, in the same order; an array is an element holding one child per item (legs/leg, containers/container, milestones/milestone, charges/charge, documents/document, changed_fields/field, otherwise item); null is xsi:nil=\"true\"; numbers and booleans as JSON writes them; a key that is not an XML name gets a leading underscore.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OutboundShipmentMessage"
              }
            },
            "application/xml": {
              "schema": {
                "$ref": "#/components/schemas/OutboundShipmentMessage"
              }
            }
          }
        },
        "responses": {
          "2XX": {
            "description": "Accepted. Any other answer is retried."
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "apiKey": {
        "type": "apiKey",
        "in": "header",
        "name": "X-API-Key"
      },
      "bearer": {
        "type": "http",
        "scheme": "bearer",
        "description": "The same API key, as a bearer token."
      }
    },
    "parameters": {
      "Limit": {
        "name": "limit",
        "in": "query",
        "required": false,
        "description": "Rows per page, 1 to 500.",
        "schema": {
          "type": "integer",
          "minimum": 1,
          "maximum": 500,
          "default": 100
        }
      },
      "Cursor": {
        "name": "cursor",
        "in": "query",
        "required": false,
        "description": "`page.next_cursor` of the previous page.",
        "schema": {
          "type": "string"
        }
      },
      "UpdatedSince": {
        "name": "updated_since",
        "in": "query",
        "required": false,
        "description": "Only rows with updated_at at or after this ISO 8601 date or date-time (with a zone).",
        "schema": {
          "type": "string"
        }
      },
      "IncludeDeleted": {
        "name": "include_deleted",
        "in": "query",
        "required": false,
        "description": "Also return soft-deleted rows (deleted_at set).",
        "schema": {
          "type": "boolean",
          "default": false
        }
      },
      "IdempotencyKey": {
        "name": "Idempotency-Key",
        "in": "header",
        "required": true,
        "description": "Unique per request; resend the same value to retry safely.",
        "schema": {
          "type": "string",
          "pattern": "^[A-Za-z0-9_.:\\-]{8,255}$"
        }
      }
    },
    "headers": {
      "RequestId": {
        "description": "Identifier of this call in the YLOAD audit log.",
        "schema": {
          "type": "string",
          "format": "uuid"
        }
      },
      "RateLimitLimit": {
        "description": "Requests allowed per minute for this key.",
        "schema": {
          "type": "integer"
        }
      },
      "RateLimitRemaining": {
        "description": "Requests left in the current minute.",
        "schema": {
          "type": "integer"
        }
      },
      "RateLimitReset": {
        "description": "Seconds until the window resets.",
        "schema": {
          "type": "integer"
        }
      }
    },
    "responses": {
      "BadRequest": {
        "description": "A query parameter, body field or the Idempotency-Key is missing, unknown or invalid.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "Unauthorized": {
        "description": "No key, an unknown key, or a revoked or expired one.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "Forbidden": {
        "description": "insufficient_scope, module_not_enabled, manager_required, or YLOAD's access rules refuse the change.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "NotFound": {
        "description": "No such row in this workspace.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "Conflict": {
        "description": "A unique value is taken, or a confirmation is not in a state to be confirmed (approval_pending, confirmation_rejected, confirmation_expired, already_confirmed).",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "Unprocessable": {
        "description": "The request does not fit the record's state or a rule (invalid_state, invalid_reference), or the Idempotency-Key was used for a different request.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "RateLimited": {
        "description": "Over the key's per-minute limit. Retry after the Retry-After header's seconds.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      }
    },
    "schemas": {
      "Shipment": {
        "type": "object",
        "description": "Shipments of every transport mode in one shape. Fields a mode does not record are null.",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Stable identifier."
          },
          "mode": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "sea",
              "air",
              "road",
              "rail",
              "breakbulk",
              "multimodal",
              null
            ],
            "description": "Transport mode of the file the row belongs to."
          },
          "tenant_id": {
            "type": "string",
            "description": "Workspace short code. Always the key's own workspace."
          },
          "reference": {
            "type": [
              "string",
              "null"
            ],
            "description": "File reference shown in YLOAD (short id)."
          },
          "status": {
            "type": [
              "string",
              "null"
            ],
            "description": "Status as recorded by the mode."
          },
          "direction": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "import",
              "export",
              "cross_trade",
              "domestic",
              null
            ],
            "description": "Trade direction, where recorded."
          },
          "client_reference": {
            "type": [
              "string",
              "null"
            ],
            "description": "The customer's own reference."
          },
          "customer_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "Customer party (GET /v1/parties/{id})."
          },
          "shipper_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "Shipper party."
          },
          "consignee_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "Consignee party."
          },
          "carrier_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "Carrier, airline, haulier or rail operator party."
          },
          "carrier_name": {
            "type": [
              "string",
              "null"
            ],
            "description": "Carrier name, where the mode stores one."
          },
          "origin_code": {
            "type": [
              "string",
              "null"
            ],
            "description": "Origin port, airport or station code."
          },
          "origin_name": {
            "type": [
              "string",
              "null"
            ],
            "description": "Origin city, address or station name."
          },
          "origin_country": {
            "type": [
              "string",
              "null"
            ],
            "description": "Origin country."
          },
          "destination_code": {
            "type": [
              "string",
              "null"
            ],
            "description": "Destination port, airport or station code."
          },
          "destination_name": {
            "type": [
              "string",
              "null"
            ],
            "description": "Destination city, address or station name."
          },
          "destination_country": {
            "type": [
              "string",
              "null"
            ],
            "description": "Destination country."
          },
          "etd": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "Estimated departure (road: planned loading)."
          },
          "atd": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "Actual departure (road: actual loading)."
          },
          "eta": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "Estimated arrival (road: planned unloading)."
          },
          "ata": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "Actual arrival (road: actual unloading)."
          },
          "booking_reference": {
            "type": [
              "string",
              "null"
            ],
            "description": "Carrier booking reference."
          },
          "master_document_number": {
            "type": [
              "string",
              "null"
            ],
            "description": "MBL (sea), MAWB (air) or CMR number (road)."
          },
          "house_document_number": {
            "type": [
              "string",
              "null"
            ],
            "description": "HBL (sea) or HAWB (air)."
          },
          "transport_means": {
            "type": [
              "string",
              "null"
            ],
            "description": "Vessel (sea, breakbulk), flight number (air), vehicle plate (road) or train number (rail)."
          },
          "voyage": {
            "type": [
              "string",
              "null"
            ],
            "description": "Voyage number (sea, breakbulk)."
          },
          "incoterm": {
            "type": [
              "string",
              "null"
            ],
            "description": "Incoterm."
          },
          "commodity": {
            "type": [
              "string",
              "null"
            ],
            "description": "Commodity."
          },
          "cargo_description": {
            "type": [
              "string",
              "null"
            ],
            "description": "Cargo description."
          },
          "gross_weight_kg": {
            "type": [
              "number",
              "null"
            ],
            "description": "Gross weight in kilograms; null where the source value is not a plain number."
          },
          "pieces": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Number of pieces or packages."
          },
          "quote_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "Quote the shipment was created from."
          },
          "required_by": {
            "type": [
              "string",
              "null"
            ],
            "format": "date",
            "description": "Date the customer needs the cargo by."
          },
          "closed_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When the file was closed."
          },
          "created_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When the row was created."
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "description": "Last change; the pagination and updated_since key. Falls back to created_at where the source keeps no change time."
          },
          "deleted_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "Soft-delete time. Rows with a value are returned only with include_deleted=true."
          }
        },
        "required": [
          "id",
          "mode",
          "tenant_id",
          "reference",
          "status",
          "direction",
          "client_reference",
          "customer_id",
          "shipper_id",
          "consignee_id",
          "carrier_id",
          "carrier_name",
          "origin_code",
          "origin_name",
          "origin_country",
          "destination_code",
          "destination_name",
          "destination_country",
          "etd",
          "atd",
          "eta",
          "ata",
          "booking_reference",
          "master_document_number",
          "house_document_number",
          "transport_means",
          "voyage",
          "incoterm",
          "commodity",
          "cargo_description",
          "gross_weight_kg",
          "pieces",
          "quote_id",
          "required_by",
          "closed_at",
          "created_at",
          "updated_at",
          "deleted_at"
        ],
        "x-yload-view": "dwh.shipments_v1"
      },
      "Leg": {
        "type": "object",
        "description": "Legs of every mode. Sea and air legs are the positions of the file's routing; their id is derived from (mode, shipment, position), so it changes meaning if a leg is inserted before it.",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Stable identifier."
          },
          "mode": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "sea",
              "air",
              "road",
              "rail",
              "breakbulk",
              "multimodal",
              null
            ],
            "description": "Transport mode of the file the row belongs to."
          },
          "tenant_id": {
            "type": "string",
            "description": "Workspace short code. Always the key's own workspace."
          },
          "shipment_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "Identifier of the shipment (GET /v1/shipments/{id})."
          },
          "sequence": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Position of the leg in the shipment."
          },
          "leg_mode": {
            "type": [
              "string",
              "null"
            ],
            "description": "Mode of this leg (multimodal: the leg's own mode)."
          },
          "leg_type": {
            "type": [
              "string",
              "null"
            ],
            "description": "Leg type (road; sea routing: preliminary, main, subsequent, direct)."
          },
          "child_shipment_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "Multimodal: the shipment that carries this leg."
          },
          "from_code": {
            "type": [
              "string",
              "null"
            ],
            "description": "Origin code."
          },
          "from_name": {
            "type": [
              "string",
              "null"
            ],
            "description": "Origin name."
          },
          "to_code": {
            "type": [
              "string",
              "null"
            ],
            "description": "Destination code."
          },
          "to_name": {
            "type": [
              "string",
              "null"
            ],
            "description": "Destination name."
          },
          "carrier_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "Carrier of the leg."
          },
          "carrier_name": {
            "type": [
              "string",
              "null"
            ],
            "description": "Carrier name."
          },
          "service_ref": {
            "type": [
              "string",
              "null"
            ],
            "description": "Service or train reference."
          },
          "etd": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "Estimated departure."
          },
          "eta": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "Estimated arrival."
          },
          "atd": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "Actual departure."
          },
          "ata": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "Actual arrival."
          },
          "created_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When the row was created."
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "description": "Last change; the pagination and updated_since key. Falls back to created_at where the source keeps no change time."
          }
        },
        "required": [
          "id",
          "mode",
          "tenant_id",
          "shipment_id",
          "sequence",
          "leg_mode",
          "leg_type",
          "child_shipment_id",
          "from_code",
          "from_name",
          "to_code",
          "to_name",
          "carrier_id",
          "carrier_name",
          "service_ref",
          "etd",
          "eta",
          "atd",
          "ata",
          "created_at",
          "updated_at"
        ],
        "x-yload-view": "dwh.legs_v1"
      },
      "Milestone": {
        "type": "object",
        "description": "Milestones of sea, air, road, rail and multimodal shipments.",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Stable identifier."
          },
          "mode": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "sea",
              "air",
              "road",
              "rail",
              "breakbulk",
              "multimodal",
              null
            ],
            "description": "Transport mode of the file the row belongs to."
          },
          "tenant_id": {
            "type": "string",
            "description": "Workspace short code. Always the key's own workspace."
          },
          "shipment_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "Identifier of the shipment (GET /v1/shipments/{id})."
          },
          "milestone_key": {
            "type": [
              "string",
              "null"
            ],
            "description": "Machine key of the milestone."
          },
          "label": {
            "type": [
              "string",
              "null"
            ],
            "description": "Label shown in YLOAD."
          },
          "status": {
            "type": [
              "string",
              "null"
            ],
            "description": "Milestone status."
          },
          "planned_date": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "Planned date (sea, rail)."
          },
          "expected_date": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "Expected date."
          },
          "actual_date": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "Actual date."
          },
          "delay_days": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Recorded delay in days."
          },
          "delay_reason": {
            "type": [
              "string",
              "null"
            ],
            "description": "Recorded delay reason."
          },
          "source": {
            "type": [
              "string",
              "null"
            ],
            "description": "Where the last update came from."
          },
          "sort_order": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Display order."
          },
          "created_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When the row was created."
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "description": "Last change; the pagination and updated_since key. Falls back to created_at where the source keeps no change time."
          }
        },
        "required": [
          "id",
          "mode",
          "tenant_id",
          "shipment_id",
          "milestone_key",
          "label",
          "status",
          "planned_date",
          "expected_date",
          "actual_date",
          "delay_days",
          "delay_reason",
          "source",
          "sort_order",
          "created_at",
          "updated_at"
        ],
        "x-yload-view": "dwh.milestones_v1"
      },
      "Charge": {
        "type": "object",
        "description": "Charge lines of every mode. Buy-side fields (cost, creditor, AP status) are returned only to keys with the finance:cost scope.",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Stable identifier."
          },
          "mode": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "sea",
              "air",
              "road",
              "rail",
              "breakbulk",
              "multimodal",
              null
            ],
            "description": "Transport mode of the file the row belongs to."
          },
          "tenant_id": {
            "type": "string",
            "description": "Workspace short code. Always the key's own workspace."
          },
          "shipment_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "Identifier of the shipment (GET /v1/shipments/{id})."
          },
          "charge_code": {
            "type": [
              "string",
              "null"
            ],
            "description": "Charge code."
          },
          "category": {
            "type": [
              "string",
              "null"
            ],
            "description": "Charge category."
          },
          "description": {
            "type": [
              "string",
              "null"
            ],
            "description": "Description."
          },
          "charge_type": {
            "type": [
              "string",
              "null"
            ],
            "description": "Charge type."
          },
          "basis": {
            "type": [
              "string",
              "null"
            ],
            "description": "Calculation basis."
          },
          "quantity": {
            "type": [
              "number",
              "null"
            ],
            "description": "Quantity (sea, air, road)."
          },
          "unit": {
            "type": [
              "string",
              "null"
            ],
            "description": "Unit of the quantity."
          },
          "sell_rate": {
            "type": [
              "number",
              "null"
            ],
            "description": "Sell rate per unit."
          },
          "sell_amount": {
            "type": [
              "number",
              "null"
            ],
            "description": "Sell amount."
          },
          "sell_currency": {
            "type": [
              "string",
              "null"
            ],
            "description": "Sell currency."
          },
          "cost_rate": {
            "type": [
              "number",
              "null"
            ],
            "description": "Cost rate per unit. Only returned to keys with the finance:cost scope.",
            "x-yload-scope": "finance:cost"
          },
          "cost_amount": {
            "type": [
              "number",
              "null"
            ],
            "description": "Cost amount. Only returned to keys with the finance:cost scope.",
            "x-yload-scope": "finance:cost"
          },
          "cost_currency": {
            "type": [
              "string",
              "null"
            ],
            "description": "Cost currency. Only returned to keys with the finance:cost scope.",
            "x-yload-scope": "finance:cost"
          },
          "debtor": {
            "type": [
              "string",
              "null"
            ],
            "description": "Who is billed."
          },
          "creditor": {
            "type": [
              "string",
              "null"
            ],
            "description": "Who bills us. Only returned to keys with the finance:cost scope.",
            "x-yload-scope": "finance:cost"
          },
          "ar_status": {
            "type": [
              "string",
              "null"
            ],
            "description": "Receivable status."
          },
          "ap_status": {
            "type": [
              "string",
              "null"
            ],
            "description": "Payable status. Only returned to keys with the finance:cost scope.",
            "x-yload-scope": "finance:cost"
          },
          "state": {
            "type": [
              "string",
              "null"
            ],
            "description": "Charge state."
          },
          "invoice_ref": {
            "type": [
              "string",
              "null"
            ],
            "description": "Invoice the charge is on."
          },
          "visibility": {
            "type": [
              "string",
              "null"
            ],
            "description": "Visibility in YLOAD."
          },
          "created_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When the row was created."
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "description": "Last change; the pagination and updated_since key. Falls back to created_at where the source keeps no change time."
          }
        },
        "required": [
          "id",
          "mode",
          "tenant_id",
          "shipment_id",
          "charge_code",
          "category",
          "description",
          "charge_type",
          "basis",
          "quantity",
          "unit",
          "sell_rate",
          "sell_amount",
          "sell_currency",
          "debtor",
          "ar_status",
          "state",
          "invoice_ref",
          "visibility",
          "created_at",
          "updated_at"
        ],
        "x-yload-view": "dwh.charges_v1"
      },
      "Invoice": {
        "type": "object",
        "description": "Customer invoices, proformas and credit notes from the finance ledger.",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Stable identifier."
          },
          "mode": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "sea",
              "air",
              "road",
              "rail",
              "breakbulk",
              "multimodal",
              null
            ],
            "description": "Transport mode of the file the row belongs to."
          },
          "tenant_id": {
            "type": "string",
            "description": "Workspace short code. Always the key's own workspace."
          },
          "shipment_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "Identifier of the shipment (GET /v1/shipments/{id})."
          },
          "shipment_reference": {
            "type": [
              "string",
              "null"
            ],
            "description": "File reference of the shipment."
          },
          "invoice_number": {
            "type": [
              "string",
              "null"
            ],
            "description": "Invoice number."
          },
          "invoice_type": {
            "type": [
              "string",
              "null"
            ],
            "description": "final, proforma or credit_note."
          },
          "status": {
            "type": [
              "string",
              "null"
            ],
            "description": "Invoice status."
          },
          "currency": {
            "type": [
              "string",
              "null"
            ],
            "description": "Currency."
          },
          "subtotal": {
            "type": [
              "number",
              "null"
            ],
            "description": "Total before VAT."
          },
          "vat_percent": {
            "type": [
              "number",
              "null"
            ],
            "description": "VAT rate."
          },
          "vat_amount": {
            "type": [
              "number",
              "null"
            ],
            "description": "VAT amount."
          },
          "total": {
            "type": [
              "number",
              "null"
            ],
            "description": "Total including VAT."
          },
          "paid_amount": {
            "type": [
              "number",
              "null"
            ],
            "description": "Amount paid so far."
          },
          "debtor_name": {
            "type": [
              "string",
              "null"
            ],
            "description": "Billed party name."
          },
          "debtor_code": {
            "type": [
              "string",
              "null"
            ],
            "description": "Billed party code."
          },
          "debtor_tax_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "Billed party tax id."
          },
          "debtor_country": {
            "type": [
              "string",
              "null"
            ],
            "description": "Billed party country."
          },
          "issue_date": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "Issue date."
          },
          "due_date": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "Due date."
          },
          "sent_date": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When it was sent."
          },
          "paid_date": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When it was paid."
          },
          "finalized_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When it was finalised."
          },
          "cancelled_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When it was cancelled."
          },
          "credit_note_for": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid",
            "description": "Invoice a credit note corrects."
          },
          "lines": {
            "description": "Invoice lines as stored."
          },
          "created_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When the row was created."
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "description": "Last change; the pagination and updated_since key. Falls back to created_at where the source keeps no change time."
          }
        },
        "required": [
          "id",
          "mode",
          "tenant_id",
          "shipment_id",
          "shipment_reference",
          "invoice_number",
          "invoice_type",
          "status",
          "currency",
          "subtotal",
          "vat_percent",
          "vat_amount",
          "total",
          "paid_amount",
          "debtor_name",
          "debtor_code",
          "debtor_tax_id",
          "debtor_country",
          "issue_date",
          "due_date",
          "sent_date",
          "paid_date",
          "finalized_at",
          "cancelled_at",
          "credit_note_for",
          "lines",
          "created_at",
          "updated_at"
        ],
        "x-yload-view": "dwh.invoices_v1"
      },
      "Party": {
        "type": "object",
        "description": "Customers, suppliers, carriers and other companies of the workspace.",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Stable identifier."
          },
          "tenant_id": {
            "type": "string",
            "description": "Workspace short code. Always the key's own workspace."
          },
          "display_name": {
            "type": [
              "string",
              "null"
            ],
            "description": "Name shown in YLOAD."
          },
          "legal_name": {
            "type": [
              "string",
              "null"
            ],
            "description": "Legal name."
          },
          "vat_number": {
            "type": [
              "string",
              "null"
            ],
            "description": "VAT number."
          },
          "registration_number": {
            "type": [
              "string",
              "null"
            ],
            "description": "Company registration number."
          },
          "eori_number": {
            "type": [
              "string",
              "null"
            ],
            "description": "EORI number."
          },
          "business_role": {
            "type": [
              "string",
              "null"
            ],
            "description": "Business role."
          },
          "customer_type": {
            "type": [
              "string",
              "null"
            ],
            "description": "Customer type."
          },
          "is_customer": {
            "type": [
              "boolean",
              "null"
            ],
            "description": "Receivable party (we bill them)."
          },
          "is_supplier": {
            "type": [
              "boolean",
              "null"
            ],
            "description": "Payable party (they bill us)."
          },
          "is_carrier": {
            "type": [
              "boolean",
              "null"
            ],
            "description": "Carrier."
          },
          "is_subcontractor": {
            "type": [
              "boolean",
              "null"
            ],
            "description": "Subcontractor."
          },
          "country_code": {
            "type": [
              "string",
              "null"
            ],
            "description": "ISO country code."
          },
          "country": {
            "type": [
              "string",
              "null"
            ],
            "description": "Country."
          },
          "city": {
            "type": [
              "string",
              "null"
            ],
            "description": "City."
          },
          "address": {
            "type": [
              "string",
              "null"
            ],
            "description": "Address."
          },
          "postal_code": {
            "type": [
              "string",
              "null"
            ],
            "description": "Postal code."
          },
          "email": {
            "type": [
              "string",
              "null"
            ],
            "description": "Email."
          },
          "phone": {
            "type": [
              "string",
              "null"
            ],
            "description": "Phone."
          },
          "website": {
            "type": [
              "string",
              "null"
            ],
            "description": "Website."
          },
          "preferred_currency": {
            "type": [
              "string",
              "null"
            ],
            "description": "Preferred currency."
          },
          "payment_terms_days": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Payment terms in days."
          },
          "account_status": {
            "type": [
              "string",
              "null"
            ],
            "description": "Account status."
          },
          "is_active": {
            "type": [
              "boolean",
              "null"
            ],
            "description": "Active in YLOAD."
          },
          "is_merged": {
            "type": [
              "boolean",
              "null"
            ],
            "description": "Merged into another record (see master_record_id)."
          },
          "master_record_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid",
            "description": "Record this one was merged into."
          },
          "created_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When the row was created."
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "description": "Last change; the pagination and updated_since key. Falls back to created_at where the source keeps no change time."
          },
          "deleted_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "Soft-delete time. Rows with a value are returned only with include_deleted=true."
          }
        },
        "required": [
          "id",
          "tenant_id",
          "display_name",
          "legal_name",
          "vat_number",
          "registration_number",
          "eori_number",
          "business_role",
          "customer_type",
          "is_customer",
          "is_supplier",
          "is_carrier",
          "is_subcontractor",
          "country_code",
          "country",
          "city",
          "address",
          "postal_code",
          "email",
          "phone",
          "website",
          "preferred_currency",
          "payment_terms_days",
          "account_status",
          "is_active",
          "is_merged",
          "master_record_id",
          "created_at",
          "updated_at",
          "deleted_at"
        ],
        "x-yload-view": "dwh.parties_v1"
      },
      "Quote": {
        "type": "object",
        "description": "Customer quotes. Buy total and margin are returned only to keys with the finance:cost scope.",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Stable identifier."
          },
          "tenant_id": {
            "type": "string",
            "description": "Workspace short code. Always the key's own workspace."
          },
          "quote_number": {
            "type": [
              "string",
              "null"
            ],
            "description": "Quote number."
          },
          "status": {
            "type": [
              "string",
              "null"
            ],
            "description": "Quote status."
          },
          "mode": {
            "type": [
              "string",
              "null"
            ],
            "description": "Transport mode quoted, lower case."
          },
          "direction": {
            "type": [
              "string",
              "null"
            ],
            "description": "Trade direction."
          },
          "incoterm": {
            "type": [
              "string",
              "null"
            ],
            "description": "Incoterm."
          },
          "party_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid",
            "description": "Customer party (GET /v1/parties/{id})."
          },
          "client_reference": {
            "type": [
              "string",
              "null"
            ],
            "description": "The customer's own reference."
          },
          "pol": {
            "type": [
              "string",
              "null"
            ],
            "description": "Port or place of loading."
          },
          "pod": {
            "type": [
              "string",
              "null"
            ],
            "description": "Port or place of discharge."
          },
          "pickup_location": {
            "type": [
              "string",
              "null"
            ],
            "description": "Pickup location."
          },
          "delivery_location": {
            "type": [
              "string",
              "null"
            ],
            "description": "Delivery location."
          },
          "commodity": {
            "type": [
              "string",
              "null"
            ],
            "description": "Commodity."
          },
          "cargo_description": {
            "type": [
              "string",
              "null"
            ],
            "description": "Cargo description."
          },
          "gross_weight": {
            "type": [
              "number",
              "null"
            ],
            "description": "Gross weight."
          },
          "volume_cbm": {
            "type": [
              "number",
              "null"
            ],
            "description": "Volume in cubic metres."
          },
          "quantity": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Quantity."
          },
          "currency": {
            "type": [
              "string",
              "null"
            ],
            "description": "Quote currency."
          },
          "valid_until": {
            "type": [
              "string",
              "null"
            ],
            "format": "date",
            "description": "Valid until."
          },
          "est_departure": {
            "type": [
              "string",
              "null"
            ],
            "format": "date",
            "description": "Estimated departure."
          },
          "est_arrival": {
            "type": [
              "string",
              "null"
            ],
            "format": "date",
            "description": "Estimated arrival."
          },
          "sell_total": {
            "type": [
              "number",
              "null"
            ],
            "description": "Sell total."
          },
          "buy_total": {
            "type": [
              "number",
              "null"
            ],
            "description": "Buy total. Only returned to keys with the finance:cost scope.",
            "x-yload-scope": "finance:cost"
          },
          "margin_total": {
            "type": [
              "number",
              "null"
            ],
            "description": "Margin. Only returned to keys with the finance:cost scope.",
            "x-yload-scope": "finance:cost"
          },
          "sent_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When it was sent."
          },
          "accepted_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When it was accepted."
          },
          "rejected_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When it was rejected."
          },
          "expired_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When it expired."
          },
          "shipment_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "Shipment created from the quote."
          },
          "shipment_reference": {
            "type": [
              "string",
              "null"
            ],
            "description": "File reference of that shipment."
          },
          "created_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When the row was created."
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "description": "Last change; the pagination and updated_since key. Falls back to created_at where the source keeps no change time."
          }
        },
        "required": [
          "id",
          "tenant_id",
          "quote_number",
          "status",
          "mode",
          "direction",
          "incoterm",
          "party_id",
          "client_reference",
          "pol",
          "pod",
          "pickup_location",
          "delivery_location",
          "commodity",
          "cargo_description",
          "gross_weight",
          "volume_cbm",
          "quantity",
          "currency",
          "valid_until",
          "est_departure",
          "est_arrival",
          "sell_total",
          "sent_at",
          "accepted_at",
          "rejected_at",
          "expired_at",
          "shipment_id",
          "shipment_reference",
          "created_at",
          "updated_at"
        ],
        "x-yload-view": "dwh.quotes_v1"
      },
      "Document": {
        "type": "object",
        "description": "Metadata of shipment documents. File contents are not served by this version.",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Stable identifier."
          },
          "mode": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "sea",
              "air",
              "road",
              "rail",
              "breakbulk",
              "multimodal",
              null
            ],
            "description": "Transport mode of the file the row belongs to."
          },
          "tenant_id": {
            "type": "string",
            "description": "Workspace short code. Always the key's own workspace."
          },
          "shipment_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "Identifier of the shipment (GET /v1/shipments/{id})."
          },
          "name": {
            "type": [
              "string",
              "null"
            ],
            "description": "Document name."
          },
          "category": {
            "type": [
              "string",
              "null"
            ],
            "description": "Category."
          },
          "doc_type": {
            "type": [
              "string",
              "null"
            ],
            "description": "Document type."
          },
          "status": {
            "type": [
              "string",
              "null"
            ],
            "description": "Status."
          },
          "visibility": {
            "type": [
              "string",
              "null"
            ],
            "description": "Visibility in YLOAD."
          },
          "required": {
            "type": [
              "boolean",
              "null"
            ],
            "description": "Required for the file."
          },
          "has_file": {
            "type": [
              "boolean",
              "null"
            ],
            "description": "A file is uploaded."
          },
          "file_size": {
            "type": [
              "string",
              "null"
            ],
            "description": "File size as recorded."
          },
          "uploaded_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "Upload time."
          },
          "source": {
            "type": [
              "string",
              "null"
            ],
            "description": "Where the document came from."
          },
          "tags": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "type": "string"
            },
            "description": "Tags."
          },
          "created_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When the row was created."
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "description": "Last change; the pagination and updated_since key. Falls back to created_at where the source keeps no change time."
          }
        },
        "required": [
          "id",
          "mode",
          "tenant_id",
          "shipment_id",
          "name",
          "category",
          "doc_type",
          "status",
          "visibility",
          "required",
          "has_file",
          "file_size",
          "uploaded_at",
          "source",
          "tags",
          "created_at",
          "updated_at"
        ],
        "x-yload-view": "dwh.documents_meta_v1"
      },
      "CreateCustomerRequest": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "legal_name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 300,
            "description": "Registered company name."
          },
          "display_name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 300,
            "description": "Name shown in YLOAD; the legal name when left out."
          },
          "vat_number": {
            "type": "string",
            "minLength": 1,
            "maxLength": 40,
            "description": "VAT number. Unique in the workspace."
          },
          "registration_number": {
            "type": "string",
            "minLength": 1,
            "maxLength": 60,
            "description": "Company registration number."
          },
          "eori_number": {
            "type": "string",
            "minLength": 1,
            "maxLength": 40,
            "description": "EORI number."
          },
          "country_code": {
            "type": "string",
            "minLength": 2,
            "maxLength": 2,
            "pattern": "^[A-Z]{2}$",
            "description": "Country."
          },
          "city": {
            "type": "string",
            "minLength": 1,
            "maxLength": 120,
            "description": "City."
          },
          "address": {
            "type": "string",
            "minLength": 1,
            "maxLength": 300,
            "description": "Street address."
          },
          "postal_code": {
            "type": "string",
            "minLength": 1,
            "maxLength": 20,
            "description": "Postal code."
          },
          "email": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200,
            "pattern": "^[^@\\s]+@[^@\\s]+\\.[^@\\s]+$",
            "description": "Email."
          },
          "phone": {
            "type": "string",
            "minLength": 1,
            "maxLength": 40,
            "description": "Phone."
          },
          "website": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200,
            "description": "Website."
          },
          "preferred_currency": {
            "type": "string",
            "minLength": 3,
            "maxLength": 3,
            "pattern": "^[A-Z]{3}$",
            "description": "Invoicing currency."
          },
          "payment_terms_days": {
            "type": "integer",
            "minimum": 0,
            "maximum": 365,
            "description": "Payment terms in days."
          }
        },
        "required": [
          "legal_name"
        ]
      },
      "CreateCustomerResult": {
        "type": "object",
        "required": [
          "data",
          "request_id",
          "event_id"
        ],
        "properties": {
          "data": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "format": "uuid",
                "description": "The party (GET /v1/parties/{id})."
              },
              "display_name": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Name shown in YLOAD."
              }
            },
            "required": [
              "id",
              "display_name"
            ]
          },
          "request_id": {
            "type": "string",
            "format": "uuid"
          },
          "event_id": {
            "type": "integer",
            "description": "Identifier of the domain event this write recorded."
          }
        }
      },
      "CreateQuoteRequest": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "party_id": {
            "type": "string",
            "format": "uuid",
            "description": "The customer (GET /v1/parties/{id})."
          },
          "mode": {
            "type": "string",
            "enum": [
              "road",
              "sea",
              "air"
            ],
            "description": "Transport mode quoted."
          },
          "direction": {
            "type": "string",
            "enum": [
              "import",
              "export",
              "cross_trade",
              "domestic"
            ],
            "description": "Trade direction."
          },
          "incoterm": {
            "type": "string",
            "minLength": 3,
            "maxLength": 3,
            "pattern": "^[A-Z]{3}$",
            "description": "Incoterm."
          },
          "client_reference": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100,
            "description": "The customer's own reference."
          },
          "pol": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200,
            "description": "Port or place of loading."
          },
          "pod": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200,
            "description": "Port or place of discharge."
          },
          "pickup_location": {
            "type": "string",
            "minLength": 1,
            "maxLength": 300,
            "description": "Pickup location."
          },
          "delivery_location": {
            "type": "string",
            "minLength": 1,
            "maxLength": 300,
            "description": "Delivery location."
          },
          "commodity": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200,
            "description": "Commodity."
          },
          "cargo_description": {
            "type": "string",
            "minLength": 1,
            "maxLength": 2000,
            "description": "Cargo description."
          },
          "gross_weight": {
            "type": "number",
            "minimum": 0,
            "maximum": 10000000,
            "description": "Gross weight in kilograms."
          },
          "volume_cbm": {
            "type": "number",
            "minimum": 0,
            "maximum": 1000000,
            "description": "Volume in cubic metres."
          },
          "quantity": {
            "type": "integer",
            "minimum": 0,
            "maximum": 1000000,
            "description": "Quantity."
          },
          "currency": {
            "type": "string",
            "minLength": 3,
            "maxLength": 3,
            "pattern": "^[A-Z]{3}$",
            "description": "Quote currency; lines without their own currency use it."
          },
          "valid_until": {
            "type": "string",
            "format": "date",
            "description": "Valid until."
          },
          "est_departure": {
            "type": "string",
            "format": "date",
            "description": "Estimated departure."
          },
          "est_arrival": {
            "type": "string",
            "format": "date",
            "description": "Estimated arrival."
          },
          "lines": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "charge_name": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 200,
                  "description": "Charge name."
                },
                "unit": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 60,
                  "description": "Unit, e.g. per container."
                },
                "qty": {
                  "type": "number",
                  "minimum": 0,
                  "maximum": 1000000,
                  "description": "Quantity (1 when left out)."
                },
                "sell_rate": {
                  "type": "number",
                  "minimum": -10000000,
                  "maximum": 10000000,
                  "description": "Sell rate per unit."
                },
                "buy_rate": {
                  "type": "number",
                  "minimum": -10000000,
                  "maximum": 10000000,
                  "description": "Buy rate per unit. Needs the finance:cost scope.",
                  "x-yload-scope": "finance:cost"
                },
                "currency": {
                  "type": "string",
                  "minLength": 3,
                  "maxLength": 3,
                  "pattern": "^[A-Z]{3}$",
                  "description": "Line currency; the quote's when left out. Must match the quote's."
                },
                "is_optional": {
                  "type": "boolean",
                  "description": "An optional line, not in the totals."
                }
              },
              "required": [
                "charge_name"
              ]
            },
            "minItems": 1,
            "maxItems": 100,
            "description": "Quote lines, in order."
          }
        },
        "required": [
          "party_id",
          "mode",
          "currency",
          "lines"
        ]
      },
      "CreateQuoteResult": {
        "type": "object",
        "required": [
          "data",
          "request_id",
          "event_id"
        ],
        "properties": {
          "data": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "format": "uuid",
                "description": "The quote (GET /v1/quotes/{id})."
              },
              "quote_number": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Number assigned by YLOAD."
              },
              "status": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "draft."
              },
              "sell_total": {
                "type": [
                  "number",
                  "null"
                ],
                "description": "Sum of the non-optional lines."
              }
            },
            "required": [
              "id",
              "quote_number",
              "status",
              "sell_total"
            ]
          },
          "request_id": {
            "type": "string",
            "format": "uuid"
          },
          "event_id": {
            "type": "integer",
            "description": "Identifier of the domain event this write recorded."
          }
        }
      },
      "AcceptQuoteRequest": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "etd": {
            "type": "string",
            "format": "date-time",
            "description": "Estimated departure of the shipment; the quote's when left out."
          },
          "eta": {
            "type": "string",
            "format": "date-time",
            "description": "Estimated arrival of the shipment; the quote's when left out."
          },
          "direction": {
            "type": "string",
            "enum": [
              "import",
              "export",
              "cross_trade",
              "domestic"
            ],
            "description": "Trade direction; the quote's when left out. Air needs import or export."
          }
        },
        "required": []
      },
      "CreateShipmentRequest": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "mode": {
            "type": "string",
            "enum": [
              "road",
              "sea",
              "air"
            ],
            "description": "Transport mode. Road, sea and air are supported."
          },
          "direction": {
            "type": "string",
            "enum": [
              "import",
              "export",
              "cross_trade",
              "domestic"
            ],
            "description": "Trade direction. Required for air (import or export)."
          },
          "customer_id": {
            "type": "string",
            "format": "uuid",
            "description": "Customer party (GET /v1/parties/{id})."
          },
          "shipper_id": {
            "type": "string",
            "format": "uuid",
            "description": "Shipper party."
          },
          "consignee_id": {
            "type": "string",
            "format": "uuid",
            "description": "Consignee party."
          },
          "client_reference": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100,
            "description": "The customer's own reference."
          },
          "incoterm": {
            "type": "string",
            "minLength": 3,
            "maxLength": 3,
            "pattern": "^[A-Z]{3}$",
            "description": "Incoterm."
          },
          "origin_code": {
            "type": "string",
            "minLength": 1,
            "maxLength": 10,
            "description": "Origin port (UN/LOCODE) or airport (IATA) code. Not used for road."
          },
          "origin_name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 300,
            "description": "Origin city (sea, air) or loading address (road)."
          },
          "origin_country": {
            "type": "string",
            "minLength": 2,
            "maxLength": 2,
            "pattern": "^[A-Z]{2}$",
            "description": "Origin country."
          },
          "destination_code": {
            "type": "string",
            "minLength": 1,
            "maxLength": 10,
            "description": "Destination port or airport code. Not used for road."
          },
          "destination_name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 300,
            "description": "Destination city (sea, air) or unloading address (road)."
          },
          "destination_country": {
            "type": "string",
            "minLength": 2,
            "maxLength": 2,
            "pattern": "^[A-Z]{2}$",
            "description": "Destination country."
          },
          "etd": {
            "type": "string",
            "format": "date-time",
            "description": "Estimated departure (road: planned loading)."
          },
          "eta": {
            "type": "string",
            "format": "date-time",
            "description": "Estimated arrival (road: planned unloading)."
          },
          "commodity": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200,
            "description": "Commodity (stored for air)."
          },
          "cargo_description": {
            "type": "string",
            "minLength": 1,
            "maxLength": 2000,
            "description": "Cargo description."
          },
          "gross_weight_kg": {
            "type": "number",
            "minimum": 0,
            "maximum": 10000000,
            "description": "Gross weight in kilograms."
          },
          "pieces": {
            "type": "integer",
            "minimum": 0,
            "maximum": 1000000,
            "description": "Number of pieces or packages (sea, air)."
          },
          "required_by": {
            "type": "string",
            "format": "date",
            "description": "Date the customer needs the cargo by."
          }
        },
        "required": [
          "mode"
        ]
      },
      "CreateShipmentResult": {
        "type": "object",
        "required": [
          "data",
          "request_id",
          "event_id"
        ],
        "properties": {
          "data": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "format": "uuid",
                "description": "The shipment (GET /v1/shipments/{id})."
              },
              "mode": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Its transport mode."
              },
              "reference": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "File reference assigned by YLOAD."
              },
              "status": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Status after the operation."
              }
            },
            "required": [
              "id",
              "mode",
              "reference",
              "status"
            ]
          },
          "request_id": {
            "type": "string",
            "format": "uuid"
          },
          "event_id": {
            "type": "integer",
            "description": "Identifier of the domain event this write recorded."
          }
        }
      },
      "UpdateShipmentStatusRequest": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "status": {
            "type": "string",
            "minLength": 1,
            "maxLength": 60,
            "description": "Target status, spelled as the mode records it (see the mode's chain in the API docs)."
          },
          "reason": {
            "type": "string",
            "minLength": 1,
            "maxLength": 500,
            "description": "Why; kept in the road status history."
          }
        },
        "required": [
          "status"
        ]
      },
      "UpdateShipmentStatusResult": {
        "type": "object",
        "required": [
          "data",
          "request_id",
          "event_id"
        ],
        "properties": {
          "data": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "format": "uuid",
                "description": "The shipment (GET /v1/shipments/{id})."
              },
              "mode": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Its transport mode."
              },
              "reference": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "File reference assigned by YLOAD."
              },
              "status": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Status after the operation."
              },
              "previous_status": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Status before."
              }
            },
            "required": [
              "id",
              "mode",
              "reference",
              "status",
              "previous_status"
            ]
          },
          "request_id": {
            "type": "string",
            "format": "uuid"
          },
          "event_id": {
            "type": "integer",
            "description": "Identifier of the domain event this write recorded."
          }
        }
      },
      "AddMilestoneRequest": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "milestone_key": {
            "type": "string",
            "minLength": 1,
            "maxLength": 60,
            "pattern": "^[a-z][a-z0-9_]{1,59}$",
            "description": "Machine key, lower snake_case."
          },
          "label": {
            "type": "string",
            "minLength": 1,
            "maxLength": 120,
            "description": "Label shown in YLOAD."
          },
          "expected_date": {
            "type": "string",
            "format": "date-time",
            "description": "Expected date."
          },
          "actual_date": {
            "type": "string",
            "format": "date-time",
            "description": "When it happened; given, the milestone is added completed."
          },
          "sort_order": {
            "type": "integer",
            "minimum": 0,
            "maximum": 1000,
            "description": "Display order; after the last one when left out."
          }
        },
        "required": [
          "milestone_key",
          "label"
        ]
      },
      "AddMilestoneResult": {
        "type": "object",
        "required": [
          "data",
          "request_id",
          "event_id"
        ],
        "properties": {
          "data": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "format": "uuid",
                "description": "The milestone (listed by GET /v1/milestones)."
              },
              "shipment_id": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Its shipment."
              },
              "milestone_key": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Its key."
              },
              "status": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "pending or completed."
              }
            },
            "required": [
              "id",
              "shipment_id",
              "milestone_key",
              "status"
            ]
          },
          "request_id": {
            "type": "string",
            "format": "uuid"
          },
          "event_id": {
            "type": "integer",
            "description": "Identifier of the domain event this write recorded."
          }
        }
      },
      "CompleteMilestoneRequest": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "actual_date": {
            "type": "string",
            "format": "date-time",
            "description": "When it happened; now when left out."
          }
        },
        "required": []
      },
      "CompleteMilestoneResult": {
        "type": "object",
        "required": [
          "data",
          "request_id",
          "event_id"
        ],
        "properties": {
          "data": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "format": "uuid",
                "description": "The milestone."
              },
              "shipment_id": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Its shipment."
              },
              "status": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "completed."
              },
              "actual_date": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date-time",
                "description": "When it happened."
              }
            },
            "required": [
              "id",
              "shipment_id",
              "status",
              "actual_date"
            ]
          },
          "request_id": {
            "type": "string",
            "format": "uuid"
          },
          "event_id": {
            "type": "integer",
            "description": "Identifier of the domain event this write recorded."
          }
        }
      },
      "UploadDocumentRequest": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200,
            "description": "File name, with its extension."
          },
          "category": {
            "type": "string",
            "minLength": 1,
            "maxLength": 120,
            "description": "Document category, e.g. Commercial Invoice."
          },
          "content_type": {
            "type": "string",
            "minLength": 1,
            "maxLength": 120,
            "pattern": "^[a-z]+/[a-z0-9.+-]+$",
            "description": "MIME type of the file."
          },
          "content_base64": {
            "type": "string",
            "minLength": 1,
            "maxLength": 7000000,
            "description": "The file, base64-encoded (at most 5 MB decoded)."
          },
          "visibility": {
            "type": "string",
            "enum": [
              "internal",
              "client"
            ],
            "description": "internal (default) or client."
          }
        },
        "required": [
          "name",
          "category",
          "content_type",
          "content_base64"
        ]
      },
      "UploadDocumentResult": {
        "type": "object",
        "required": [
          "data",
          "request_id",
          "event_id"
        ],
        "properties": {
          "data": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "format": "uuid",
                "description": "The document (listed by GET /v1/documents)."
              },
              "shipment_id": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Its shipment."
              },
              "name": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "File name."
              },
              "file_size": {
                "type": [
                  "integer",
                  "null"
                ],
                "description": "Bytes stored."
              }
            },
            "required": [
              "id",
              "shipment_id",
              "name",
              "file_size"
            ]
          },
          "request_id": {
            "type": "string",
            "format": "uuid"
          },
          "event_id": {
            "type": "integer",
            "description": "Identifier of the domain event this write recorded."
          }
        }
      },
      "AssignCarrierRequest": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "carrier_id": {
            "type": "string",
            "format": "uuid",
            "description": "The carrier party (GET /v1/parties/{id})."
          }
        },
        "required": [
          "carrier_id"
        ]
      },
      "AssignCarrierResult": {
        "type": "object",
        "required": [
          "data",
          "request_id",
          "event_id"
        ],
        "properties": {
          "data": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "format": "uuid",
                "description": "The shipment."
              },
              "carrier_id": {
                "type": "string",
                "format": "uuid",
                "description": "The carrier."
              },
              "transport_order_ids": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "description": "Transport orders issued, one per movement."
              }
            },
            "required": [
              "id",
              "carrier_id",
              "transport_order_ids"
            ]
          },
          "request_id": {
            "type": "string",
            "format": "uuid"
          },
          "event_id": {
            "type": "integer",
            "description": "Identifier of the domain event this write recorded."
          }
        }
      },
      "DispatchRequest": {
        "type": "object",
        "additionalProperties": false,
        "properties": {},
        "required": []
      },
      "AddChargeRequest": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "charge": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200,
            "description": "Charge name, e.g. Ocean Freight."
          },
          "category": {
            "type": "string",
            "minLength": 1,
            "maxLength": 120,
            "description": "Charge category, e.g. Freight."
          },
          "description": {
            "type": "string",
            "minLength": 1,
            "maxLength": 500,
            "description": "Description."
          },
          "charge_type": {
            "type": "string",
            "enum": [
              "revenue",
              "cost"
            ],
            "description": "revenue (we bill the customer) or cost (we are billed)."
          },
          "sell_amount": {
            "type": "number",
            "minimum": -10000000,
            "maximum": 10000000,
            "description": "Revenue amount."
          },
          "sell_currency": {
            "type": "string",
            "minLength": 3,
            "maxLength": 3,
            "pattern": "^[A-Z]{3}$",
            "description": "Revenue currency."
          },
          "cost_amount": {
            "type": "number",
            "minimum": -10000000,
            "maximum": 10000000,
            "description": "Cost amount. Needs finance:cost.",
            "x-yload-scope": "finance:cost"
          },
          "cost_currency": {
            "type": "string",
            "minLength": 3,
            "maxLength": 3,
            "pattern": "^[A-Z]{3}$",
            "description": "Cost currency. Needs finance:cost.",
            "x-yload-scope": "finance:cost"
          },
          "debtor": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200,
            "description": "Who is billed (revenue)."
          },
          "creditor": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200,
            "description": "Who bills us (cost). Needs finance:cost.",
            "x-yload-scope": "finance:cost"
          },
          "visibility": {
            "type": "string",
            "enum": [
              "internal",
              "client"
            ],
            "description": "internal (default) or client."
          }
        },
        "required": [
          "charge",
          "category",
          "charge_type"
        ]
      },
      "RequestCloseRequest": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "reason": {
            "type": "string",
            "minLength": 1,
            "maxLength": 500,
            "description": "Why the file can be closed."
          }
        },
        "required": []
      },
      "Confirmation": {
        "type": "object",
        "required": [
          "id",
          "operation",
          "confirmation_class",
          "status",
          "summary",
          "expires_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "operation": {
            "type": "string",
            "description": "The parked operation, e.g. accept_quote."
          },
          "confirmation_class": {
            "type": "string",
            "enum": [
              "confirm",
              "human"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "approved",
              "rejected",
              "executed",
              "expired"
            ]
          },
          "summary": {
            "type": "string",
            "description": "What will be done, in one line."
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          },
          "result": {
            "type": "object",
            "description": "The operation's result, once executed."
          }
        }
      },
      "ConfirmationAnswer": {
        "type": "object",
        "required": [
          "data",
          "request_id"
        ],
        "properties": {
          "data": {
            "$ref": "#/components/schemas/Confirmation"
          },
          "request_id": {
            "type": "string",
            "format": "uuid"
          }
        }
      },
      "Event": {
        "type": "object",
        "required": [
          "seq",
          "event_type",
          "entity_type",
          "entity_id",
          "payload",
          "source",
          "occurred_at"
        ],
        "properties": {
          "seq": {
            "type": "integer",
            "description": "Position in the workspace's feed; grows in commit order."
          },
          "event_type": {
            "type": "string",
            "description": "e.g. shipment.created, milestone.completed, leg.updated, quote.status_changed, party.updated, invoice.status_changed, confirmation.approved."
          },
          "entity_type": {
            "type": "string",
            "description": "party, quote, shipment, milestone, document, charge or confirmation."
          },
          "entity_id": {
            "type": "string"
          },
          "mode": {
            "type": [
              "string",
              "null"
            ],
            "description": "Transport mode, where it applies."
          },
          "payload": {
            "type": "object",
            "description": "Identifiers and states; never amounts."
          },
          "operation": {
            "type": [
              "string",
              "null"
            ],
            "description": "The API operation that caused it."
          },
          "source": {
            "type": "string",
            "enum": [
              "engine_api",
              "yload_app"
            ],
            "description": "engine_api for a change made through this API; yload_app for a change made in YLOAD itself (a shipment, milestone, charge or document, or a person's approval)."
          },
          "request_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "occurred_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "Container": {
        "type": "object",
        "description": "A container of a sea or rail shipment.",
        "required": [
          "id",
          "mode",
          "tenant_id",
          "shipment_id",
          "sequence"
        ],
        "properties": {
          "id": {
            "type": "string",
            "description": "<shipment id>:<sequence>."
          },
          "mode": {
            "type": "string",
            "enum": [
              "sea",
              "rail"
            ]
          },
          "tenant_id": {
            "type": "string"
          },
          "shipment_id": {
            "type": "string"
          },
          "sequence": {
            "type": "integer",
            "description": "Position on the shipment, from 1."
          },
          "container_number": {
            "type": [
              "string",
              "null"
            ]
          },
          "container_type": {
            "type": [
              "string",
              "null"
            ],
            "description": "Size/type as entered, e.g. 40HC."
          },
          "iso_type": {
            "type": [
              "string",
              "null"
            ]
          },
          "seal_number": {
            "type": [
              "string",
              "null"
            ]
          },
          "gross_weight": {
            "type": [
              "string",
              "null"
            ],
            "description": "As entered."
          },
          "package_count": {
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "type": [
              "string",
              "null"
            ]
          },
          "is_dangerous": {
            "type": [
              "boolean",
              "null"
            ]
          },
          "is_reefer": {
            "type": [
              "boolean",
              "null"
            ]
          }
        }
      },
      "OutboundShipment": {
        "description": "The complete shipment: a Shipment with its parties and the records the API lists for it.",
        "allOf": [
          {
            "$ref": "#/components/schemas/Shipment"
          },
          {
            "type": "object",
            "required": [
              "parties",
              "legs",
              "containers",
              "milestones",
              "charges",
              "documents"
            ],
            "properties": {
              "parties": {
                "type": "object",
                "description": "customer, shipper, consignee and carrier, where the shipment names a party YLOAD knows.",
                "additionalProperties": {
                  "$ref": "#/components/schemas/Party"
                }
              },
              "legs": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/Leg"
                }
              },
              "containers": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/Container"
                }
              },
              "milestones": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/Milestone"
                }
              },
              "charges": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/Charge"
                },
                "description": "Buy-side fields only when the endpoint is set to include costs."
              },
              "documents": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/Document"
                }
              }
            }
          }
        ]
      },
      "OutboundShipmentMessage": {
        "type": "object",
        "required": [
          "schema",
          "event",
          "workspace",
          "shipment_ref",
          "snapshot_at",
          "shipment"
        ],
        "properties": {
          "schema": {
            "type": "string",
            "const": "yload.shipment-message.v1"
          },
          "event": {
            "type": "object",
            "required": [
              "id",
              "seq",
              "shipment_seq",
              "type",
              "entity_type",
              "entity_id",
              "occurred_at",
              "source",
              "payload"
            ],
            "properties": {
              "id": {
                "type": "integer",
                "description": "The event id; also the Idempotency-Key header. A resend repeats it."
              },
              "seq": {
                "type": "integer",
                "description": "The event's position in the workspace's feed (GET /v1/events)."
              },
              "shipment_seq": {
                "type": "integer",
                "description": "1, 2, 3… for the messages about this shipment to this endpoint."
              },
              "type": {
                "type": "string",
                "enum": [
                  "shipment.created",
                  "shipment.updated",
                  "shipment.status_changed",
                  "shipment.deleted",
                  "shipment.carrier_assigned",
                  "shipment.dispatched",
                  "shipment.close_approved",
                  "milestone.added",
                  "milestone.completed",
                  "milestone.updated",
                  "milestone.removed",
                  "charge.added",
                  "charge.updated",
                  "charge.removed",
                  "document.added",
                  "document.uploaded",
                  "document.updated",
                  "document.removed",
                  "leg.added",
                  "leg.updated",
                  "leg.removed"
                ]
              },
              "entity_type": {
                "type": "string",
                "description": "shipment, milestone, charge or document."
              },
              "entity_id": {
                "type": "string"
              },
              "occurred_at": {
                "type": "string",
                "format": "date-time"
              },
              "source": {
                "type": "string",
                "enum": [
                  "engine_api",
                  "yload_app"
                ]
              },
              "operation": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "payload": {
                "type": "object",
                "description": "As in GET /v1/events: identifiers, states and, for an update, changed_fields."
              }
            }
          },
          "workspace": {
            "type": "string",
            "description": "The workspace short code."
          },
          "shipment_ref": {
            "type": "object",
            "required": [
              "mode",
              "id"
            ],
            "properties": {
              "mode": {
                "type": "string"
              },
              "id": {
                "type": "string"
              }
            }
          },
          "snapshot_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the shipment below was read: at the first attempt, after the event."
          },
          "shipment": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/OutboundShipment"
              },
              {
                "type": "null"
              }
            ],
            "description": "Null once the shipment is deleted, or when the workspace no longer has its mode enabled."
          }
        }
      },
      "EventPage": {
        "type": "object",
        "required": [
          "limit",
          "has_more",
          "next_cursor"
        ],
        "properties": {
          "limit": {
            "type": "integer"
          },
          "has_more": {
            "type": "boolean"
          },
          "next_cursor": {
            "type": "string",
            "description": "Pass as `cursor` to continue; on an empty page, the cursor you sent."
          }
        }
      },
      "Page": {
        "type": "object",
        "required": [
          "limit",
          "has_more",
          "next_cursor"
        ],
        "properties": {
          "limit": {
            "type": "integer"
          },
          "has_more": {
            "type": "boolean",
            "description": "More rows exist after this page right now."
          },
          "next_cursor": {
            "type": [
              "string",
              "null"
            ],
            "description": "Pass as `cursor` to continue after the last row of this page. Null on an empty page."
          }
        }
      },
      "Error": {
        "type": "object",
        "required": [
          "error",
          "request_id"
        ],
        "properties": {
          "error": {
            "type": "object",
            "required": [
              "code",
              "message"
            ],
            "properties": {
              "code": {
                "type": "string",
                "enum": [
                  "invalid_parameter",
                  "unauthorized",
                  "not_found",
                  "method_not_allowed",
                  "rate_limited",
                  "internal_error",
                  "invalid_json",
                  "payload_too_large",
                  "insufficient_scope",
                  "idempotency_key_required",
                  "idempotency_key_reused",
                  "module_not_enabled",
                  "forbidden",
                  "manager_required",
                  "conflict",
                  "invalid_reference",
                  "invalid_state",
                  "approval_pending",
                  "confirmation_rejected",
                  "confirmation_expired",
                  "already_confirmed",
                  "storage_error",
                  "storage_unavailable"
                ]
              },
              "message": {
                "type": "string"
              },
              "parameter": {
                "type": "string",
                "description": "The query parameter at fault (invalid_parameter only)."
              }
            }
          },
          "request_id": {
            "type": "string",
            "format": "uuid",
            "description": "Quote it when asking YLOAD about a call."
          }
        }
      }
    }
  },
  "x-yload-scopes": [
    "read",
    "finance:cost",
    "write:sales",
    "write:operations",
    "write:finance"
  ]
}
