{
  "components": {
    "schemas": {
      "Address": {
        "properties": {
          "city": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "BT-37, BT-52",
            "title": "City"
          },
          "country": {
            "anyOf": [
              {
                "examples": [
                  "DE"
                ],
                "pattern": "^[A-Z]{2}$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "BT-40, BT-55: ISO 3166-1 alpha-2",
            "title": "Country"
          },
          "postal_code": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "BT-38, BT-53",
            "title": "Postal Code"
          },
          "street": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "BT-35 (seller), BT-50 (buyer)",
            "title": "Street"
          }
        },
        "title": "Address",
        "type": "object"
      },
      "Attention": {
        "description": "What a person should look at before booking it.\n\n- `sums`: A check with `sums: true` failed\n- `outgoing`: The business issued it\n- `possible_duplicate`: An earlier document has its kind, number and seller (`possible_duplicate_of`)\n- `self_billed`: A self-billed invoice (Gutschrift): the buyer issued it",
        "enum": [
          "sums",
          "outgoing",
          "possible_duplicate",
          "self_billed"
        ],
        "title": "Attention",
        "type": "string"
      },
      "Box": {
        "description": "Where a value stands on its page: a rectangle in fractions of the\npage from its top-left corner (0 to 1, so any rendering's size), the\npage as `GET /files/{id}/content`'s pages show it (a PDF's /Rotate, an\nimage's EXIF orientation applied). From a PDF's own words exact; on a\nscan or a photo, the OCR's line and characters, an estimate.",
        "properties": {
          "x0": {
            "description": "Its left edge, from the page's left",
            "maximum": 1.0,
            "minimum": 0.0,
            "title": "X0",
            "type": "number"
          },
          "x1": {
            "description": "Its right edge, from the page's left",
            "maximum": 1.0,
            "minimum": 0.0,
            "title": "X1",
            "type": "number"
          },
          "y0": {
            "description": "Its top edge, from the page's top",
            "maximum": 1.0,
            "minimum": 0.0,
            "title": "Y0",
            "type": "number"
          },
          "y1": {
            "description": "Its bottom edge, from the page's top",
            "maximum": 1.0,
            "minimum": 0.0,
            "title": "Y1",
            "type": "number"
          }
        },
        "required": [
          "x0",
          "y0",
          "x1",
          "y1"
        ],
        "title": "Box",
        "type": "object"
      },
      "Candidate": {
        "description": "A company of the group a file may belong to (`needs_company`).",
        "properties": {
          "business_id": {
            "description": "What `PATCH` names",
            "format": "uuid",
            "title": "Business Id",
            "type": "string"
          },
          "name": {
            "title": "Name",
            "type": "string"
          },
          "why": {
            "$ref": "#/components/schemas/CandidateWhy"
          }
        },
        "required": [
          "business_id",
          "name",
          "why"
        ],
        "title": "Candidate",
        "type": "object"
      },
      "CandidateWhy": {
        "description": "Why a company may be the one a file belongs to.\n\n- `vat_id`: Its VAT ID is on the document\n- `tax_number`: Its tax number is on the document\n- `edrpou`: Its ЄДРПОУ or РНОКПП is on the document\n- `register`: Its register number and court are on the document\n- `iban`: Its account is the one the document asks to be paid into\n- `name`: Its name or address alone, which never decides\n- `home`: The key's own business",
        "enum": [
          "vat_id",
          "tax_number",
          "edrpou",
          "register",
          "iban",
          "name",
          "home"
        ],
        "title": "CandidateWhy",
        "type": "string"
      },
      "Card": {
        "description": "What a document without fields of its own says: a title, a summary\nand its facts (deadlines first).",
        "properties": {
          "facts": {
            "items": {
              "$ref": "#/components/schemas/Fact"
            },
            "title": "Facts",
            "type": "array"
          },
          "summary": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Summary"
          },
          "title": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Title"
          }
        },
        "required": [
          "facts"
        ],
        "title": "Card",
        "type": "object"
      },
      "Check": {
        "description": "A check Ocost ran in code, and whether it passed.",
        "properties": {
          "at": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The rate or the line it is about",
            "title": "At"
          },
          "fields": {
            "description": "The paths it is about, as `sources` names them",
            "items": {
              "examples": [
                "totals.gross"
              ],
              "pattern": "^[a-z_]+(\\[[0-9]+\\])?(\\.[a-z_]+)*$",
              "type": "string"
            },
            "title": "Fields",
            "type": "array"
          },
          "name": {
            "$ref": "#/components/schemas/CheckName",
            "description": "What it checked; `sums` says whether it is one of the sums"
          },
          "passed": {
            "title": "Passed",
            "type": "boolean"
          },
          "sums": {
            "description": "One of the sums (total, vat, vat_net, vat_tax, gross, payable, signs, skonto, deduction, deductions, quantity): fill a bill only when all pass",
            "title": "Sums",
            "type": "boolean"
          }
        },
        "required": [
          "name",
          "passed",
          "sums",
          "fields"
        ],
        "title": "Check",
        "type": "object"
      },
      "CheckName": {
        "description": "A check Ocost ran in code on what it read.\n\n- `total`: A total was read\n- `vat`: A VAT group's VAT is its net × rate (`at` the rate)\n- `vat_net`: The VAT groups' nets add up to the net\n- `vat_tax`: The VAT groups' VAT adds up to the VAT\n- `gross`: Net plus VAT is the gross (the net, with no VAT printed)\n- `payable`: What is left to pay is between nothing and the gross\n- `signs`: No total is negative\n- `deduction`: A deducted invoice's net plus VAT is its gross (`at` which)\n- `deductions`: The gross less the deductions is what is left to pay\n- `quantity`: A delivered quantity is positive, or the line is backordered (`at` the line)\n- `skonto`: A Skonto is plausible: up to 10 %, within a year\n- `line`: A line's quantity × price, less its discount, is its net (`at` the line)\n- `lines_net`: The lines add up to the net (the gross, priced with VAT)\n- `lines_currency`: The lines are in another currency than the totals (`at` it)\n- `vat_lines`: A VAT group's net is its lines' (`at` the rate)\n- `line_tax`: A line's printed VAT is its net × rate, and its net plus VAT its printed gross (`at` the line)\n- `lines_tax`: The lines' printed VAT adds up to their VAT group's (`at` the rate)\n- `iban`: The IBAN's check digits hold\n- `vat_id`: A VAT ID has its country's format\n- `identifier`: A party's identifier has its length and check digit (`at` its scheme: an ЄДРПОУ, a РНОКПП, a NIP)\n- `issued_on`: The issue date is neither years ago nor ahead\n- `due_on`: The due date isn't before the issue date\n- `service`: The service period starts before it ends\n- `valid_until`: A quote holds until after its issue date\n- `delivery_on`: The delivery date is near the issue date\n- `stated`: The amounts stated in a second currency add up\n- `stated_rate`: The amounts in both currencies agree at the rate printed, else the ECB's (`at` the rate)\n- `payment_sum`: A contract's payment: net plus VAT is its gross (`at` which)\n- `payment_vat`: A contract's payment: its VAT is its net × rate\n- `payment_sign`: A contract's payment: its amounts are positive\n- `step`: A stepped rent's step falls in the term, in order\n- `first_payment`: A contract's first payment falls in its term\n- `deposit`: A contract's deposit is positive",
        "enum": [
          "total",
          "vat",
          "vat_net",
          "vat_tax",
          "gross",
          "payable",
          "signs",
          "deduction",
          "deductions",
          "quantity",
          "skonto",
          "line",
          "lines_net",
          "lines_currency",
          "vat_lines",
          "line_tax",
          "lines_tax",
          "iban",
          "vat_id",
          "identifier",
          "issued_on",
          "due_on",
          "service",
          "valid_until",
          "delivery_on",
          "stated",
          "stated_rate",
          "payment_sum",
          "payment_vat",
          "payment_sign",
          "step",
          "first_payment",
          "deposit"
        ],
        "title": "CheckName",
        "type": "string"
      },
      "Confidence": {
        "description": "How sure Ocost is of a value, from its checks: never a model's grade.\n\n- `checked`: A check confirmed it, or it came from an e-invoice\n- `read`: Nothing speaks against it\n- `doubt`: A check failed (`why` names it), or its words weren't on its page",
        "enum": [
          "checked",
          "read",
          "doubt"
        ],
        "title": "Confidence",
        "type": "string"
      },
      "Contact": {
        "properties": {
          "email": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "BT-43, BT-58: an address as printed",
            "title": "Email"
          },
          "phone": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "BT-42, BT-57: as printed",
            "title": "Phone"
          }
        },
        "title": "Contact",
        "type": "object"
      },
      "Deduction": {
        "description": "A final invoice's: an earlier invoice it takes off.",
        "properties": {
          "gross": {
            "anyOf": [
              {
                "description": "An exact decimal of at most 15 significant digits. Parse it as a decimal type before calculating",
                "examples": [
                  1270.92
                ],
                "format": "decimal",
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Gross"
          },
          "issue_date": {
            "anyOf": [
              {
                "format": "date",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Issue Date"
          },
          "net": {
            "anyOf": [
              {
                "description": "An exact decimal of at most 15 significant digits. Parse it as a decimal type before calculating",
                "examples": [
                  1270.92
                ],
                "format": "decimal",
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Net"
          },
          "number": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Number"
          },
          "tax": {
            "anyOf": [
              {
                "description": "An exact decimal of at most 15 significant digits. Parse it as a decimal type before calculating",
                "examples": [
                  1270.92
                ],
                "format": "decimal",
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Tax"
          }
        },
        "title": "Deduction",
        "type": "object"
      },
      "Direction": {
        "description": "Whether the business received or issued it.\n\n- `incoming`: To the business: a supplier's\n- `outgoing`: The business issued it\n- `unsure`: Its parties don't say",
        "enum": [
          "incoming",
          "outgoing",
          "unsure"
        ],
        "title": "Direction",
        "type": "string"
      },
      "Document": {
        "description": "ocost.document.v1: one document as Ocost read it.",
        "examples": [
          {
            "attention": [],
            "buyer": {
              "address": {
                "city": "Düsseldorf",
                "country": "DE",
                "postal_code": "40213",
                "street": "Hauptstraße 1"
              },
              "name": "Beispiel Handel GmbH",
              "vat_id": "DE987654321"
            },
            "checks": [
              {
                "at": "19",
                "fields": [
                  "totals.net",
                  "totals.tax"
                ],
                "name": "vat",
                "passed": true,
                "sums": true
              },
              {
                "fields": [
                  "totals.net",
                  "totals.tax",
                  "totals.gross"
                ],
                "name": "gross",
                "passed": true,
                "sums": true
              }
            ],
            "currency": "EUR",
            "deductions": [],
            "delivery_date": "2026-10-30",
            "direction": "incoming",
            "due_date": "2026-12-03",
            "early_payment_discounts": [
              {
                "days": 14,
                "due_date": "2026-11-17",
                "percent": 2
              }
            ],
            "file_id": "01a1b08c-6e3a-7562-8f4a-7924722667b1",
            "id": "01a1b08c-7aa1-7b52-9d4e-2f1f1c0c4f11",
            "issue_date": "2026-11-03",
            "kind": "invoice",
            "kind_detail": "invoice",
            "lines": [
              {
                "attributes": {
                  "colour": "schwarz"
                },
                "id": "1",
                "name": "Bürostuhl ErgoPlus schwarz",
                "net_amount": 756,
                "price": 189,
                "quantity": 4,
                "seller_item_id": "ES-200",
                "unit": "H87",
                "vat_category": "S",
                "vat_rate": 19
              },
              {
                "attributes": {},
                "id": "2",
                "name": "Montage",
                "net_amount": 312,
                "price": 78,
                "quantity": 4,
                "unit": "HUR",
                "vat_category": "S",
                "vat_rate": 19
              }
            ],
            "number": "RE-2026-1187",
            "order_reference": "PO-2316",
            "order_references": [
              "PO-2316"
            ],
            "other_parties": [],
            "pages": [
              1
            ],
            "payment": {
              "iban": "DE02120300000000202051",
              "means": "transfer",
              "means_code": "58",
              "net_days": 30,
              "terms": "14 Tage 2 % Skonto, 30 Tage netto"
            },
            "read_with": "reader",
            "schema": "ocost.document.v1",
            "seller": {
              "address": {
                "city": "Köln",
                "country": "DE",
                "postal_code": "50667",
                "street": "Beispielweg 4"
              },
              "contact": {
                "email": "rechnung@lieferant.example"
              },
              "legal_registration_id": "HRB 12345",
              "name": "Musterbüro Lieferant GmbH",
              "vat_id": "DE123456789"
            },
            "sources": {
              "number": {
                "confidence": "read",
                "page": 1,
                "quote": "RE-2026-1187"
              },
              "seller.vat_id": {
                "confidence": "checked",
                "page": 1,
                "quote": "DE123456789"
              },
              "totals.gross": {
                "box": {
                  "x0": 0.7012,
                  "x1": 0.8874,
                  "y0": 0.6831,
                  "y1": 0.6995
                },
                "confidence": "checked",
                "page": 1,
                "quote": "1.270,92 €"
              }
            },
            "tax_check": {
              "case": "standard",
              "missing": []
            },
            "totals": {
              "gross": 1270.92,
              "net": 1068,
              "prices_include_vat": false,
              "tax": 202.92
            },
            "type_code": "380",
            "vat_breakdown": [
              {
                "category": "S",
                "rate": 19,
                "tax_amount": 202.92,
                "taxable_amount": 1068
              }
            ],
            "worked_out": []
          }
        ],
        "properties": {
          "attention": {
            "items": {
              "$ref": "#/components/schemas/Attention"
            },
            "title": "Attention",
            "type": "array"
          },
          "buyer": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Party"
              },
              {
                "type": "null"
              }
            ],
            "description": "BG-7"
          },
          "buyer_reference": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "BT-10",
            "title": "Buyer Reference"
          },
          "card": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Card"
              },
              {
                "type": "null"
              }
            ]
          },
          "checks": {
            "items": {
              "$ref": "#/components/schemas/Check"
            },
            "title": "Checks",
            "type": "array"
          },
          "contract_reference": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "BT-12: the contract it refers to (an act's)",
            "title": "Contract Reference"
          },
          "currency": {
            "anyOf": [
              {
                "examples": [
                  "EUR"
                ],
                "pattern": "^[A-Z]{3}$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "BT-5, ISO 4217",
            "title": "Currency"
          },
          "deductions": {
            "items": {
              "$ref": "#/components/schemas/Deduction"
            },
            "title": "Deductions",
            "type": "array"
          },
          "deliver_to": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Address"
              },
              {
                "type": "null"
              }
            ],
            "description": "BG-15"
          },
          "delivery_date": {
            "anyOf": [
              {
                "format": "date",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "BT-72",
            "title": "Delivery Date"
          },
          "direction": {
            "$ref": "#/components/schemas/Direction"
          },
          "due_date": {
            "anyOf": [
              {
                "format": "date",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "BT-9",
            "title": "Due Date"
          },
          "early_payment_discounts": {
            "items": {
              "$ref": "#/components/schemas/EarlyPaymentDiscount"
            },
            "title": "Early Payment Discounts",
            "type": "array"
          },
          "file_id": {
            "description": "The file it is in",
            "format": "uuid",
            "title": "File Id",
            "type": "string"
          },
          "id": {
            "description": "The document",
            "format": "uuid",
            "title": "Id",
            "type": "string"
          },
          "invoicing_period_end": {
            "anyOf": [
              {
                "format": "date",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "BT-74",
            "title": "Invoicing Period End"
          },
          "invoicing_period_start": {
            "anyOf": [
              {
                "format": "date",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "BT-73",
            "title": "Invoicing Period Start"
          },
          "issue_date": {
            "anyOf": [
              {
                "format": "date",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "BT-2",
            "title": "Issue Date"
          },
          "kind": {
            "$ref": "#/components/schemas/Kind"
          },
          "kind_detail": {
            "$ref": "#/components/schemas/KindDetail"
          },
          "lines": {
            "items": {
              "$ref": "#/components/schemas/Line"
            },
            "title": "Lines",
            "type": "array"
          },
          "number": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "BT-1",
            "title": "Number"
          },
          "order_reference": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "BT-13",
            "title": "Order Reference"
          },
          "order_references": {
            "description": "Every order it names",
            "items": {
              "type": "string"
            },
            "title": "Order References",
            "type": "array"
          },
          "other_parties": {
            "description": "Every other party named",
            "items": {
              "$ref": "#/components/schemas/OtherParty"
            },
            "title": "Other Parties",
            "type": "array"
          },
          "pages": {
            "description": "Its pages in the file, from 1",
            "items": {
              "type": "integer"
            },
            "title": "Pages",
            "type": "array"
          },
          "payee": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Party"
              },
              {
                "type": "null"
              }
            ],
            "description": "BG-10: when not the seller"
          },
          "payment": {
            "$ref": "#/components/schemas/Payment"
          },
          "possible_duplicate_of": {
            "anyOf": [
              {
                "format": "uuid",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "An earlier document of the same kind, number and seller",
            "title": "Possible Duplicate Of"
          },
          "preceding_invoice": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "BT-25; a tax invoice's: the invoice or act it is for",
            "title": "Preceding Invoice"
          },
          "read_with": {
            "$ref": "#/components/schemas/ReadWith"
          },
          "schema": {
            "const": "ocost.document.v1",
            "default": "ocost.document.v1",
            "description": "Always this",
            "title": "Schema",
            "type": "string"
          },
          "seller": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Party"
              },
              {
                "type": "null"
              }
            ],
            "description": "BG-4"
          },
          "sources": {
            "description": "Per value, by its path: `number`, `issue_date`, `due_date`, `delivery_date`, `valid_until`, `currency`, `order_reference`, `seller.name`, `buyer.name`, `seller.vat_id`, `buyer.vat_id`, `seller.contact.email`, `buyer.contact.email`, `seller.contact.phone`, `buyer.contact.phone`, `seller.website`, `buyer.website`, `seller.legal_registration_id`, `buyer.legal_registration_id`, `totals.net`, `totals.tax`, `totals.gross`, `totals.payable`, `payment.iban`, `payment.means_code`, `payment.paid_on`, `lines`, `other_parties[n].name`, `deductions[n].gross`; a later Ocost may add paths",
            "patternProperties": {
              "^[a-z_]+(\\[[0-9]+\\])?(\\.[a-z_]+)*$": {
                "$ref": "#/components/schemas/Source"
              }
            },
            "propertyNames": {
              "examples": [
                "totals.gross"
              ]
            },
            "title": "Sources",
            "type": "object"
          },
          "tax_check": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/TaxCheck"
              },
              {
                "type": "null"
              }
            ]
          },
          "tax_registration": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/TaxRegistration"
              },
              {
                "type": "null"
              }
            ],
            "description": "A tax invoice's registration, where printed"
          },
          "totals": {
            "$ref": "#/components/schemas/Totals"
          },
          "type_code": {
            "anyOf": [
              {
                "examples": [
                  "380"
                ],
                "pattern": "^[0-9]{1,3}$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "BT-3, UNCL 1001: 380 commercial invoice, 381 credit note, 384 corrected invoice, 389 self-billed invoice, 326 partial invoice, 386 prepayment invoice, 325 pro forma invoice, 875 partial construction invoice, 876 partial final construction invoice, 877 final construction invoice, 383 debit note, 393 factored invoice, 751 invoice information for accounting purposes, 81 credit note related to goods or services, 83 credit note related to financial adjustments, 261 self-billed credit note, 262 consolidated credit note, goods and services, 396 factored credit note, 532 forwarder's credit note; an e-invoice may carry another",
            "title": "Type Code"
          },
          "valid_until": {
            "anyOf": [
              {
                "format": "date",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "A quote's",
            "title": "Valid Until"
          },
          "vat_breakdown": {
            "items": {
              "$ref": "#/components/schemas/VatGroup"
            },
            "title": "Vat Breakdown",
            "type": "array"
          },
          "worked_out": {
            "items": {
              "$ref": "#/components/schemas/WorkedOut"
            },
            "title": "Worked Out",
            "type": "array"
          }
        },
        "required": [
          "id",
          "file_id",
          "pages",
          "kind",
          "kind_detail",
          "direction",
          "order_references",
          "other_parties",
          "payment",
          "early_payment_discounts",
          "totals",
          "vat_breakdown",
          "lines",
          "deductions",
          "worked_out",
          "sources",
          "checks",
          "attention",
          "read_with"
        ],
        "title": "Document",
        "type": "object"
      },
      "DocumentRef": {
        "description": "One document a file holds.",
        "properties": {
          "id": {
            "format": "uuid",
            "title": "Id",
            "type": "string"
          },
          "kind": {
            "$ref": "#/components/schemas/Kind"
          },
          "number": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "BT-1, as printed",
            "title": "Number"
          },
          "pages": {
            "description": "Its pages in the file, from 1",
            "items": {
              "type": "integer"
            },
            "title": "Pages",
            "type": "array"
          }
        },
        "required": [
          "id",
          "kind",
          "pages"
        ],
        "title": "DocumentRef",
        "type": "object"
      },
      "EarlyPaymentDiscount": {
        "description": "Skonto: XRechnung's #SKONTO# in BT-20.",
        "properties": {
          "base_amount": {
            "anyOf": [
              {
                "description": "An exact decimal of at most 15 significant digits. Parse it as a decimal type before calculating",
                "examples": [
                  1270.92
                ],
                "format": "decimal",
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "description": "What it is taken off, where printed; null: the amount due",
            "title": "Base Amount"
          },
          "days": {
            "title": "Days",
            "type": "integer"
          },
          "due_date": {
            "anyOf": [
              {
                "format": "date",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The last day for it: the issue date plus `days`",
            "title": "Due Date"
          },
          "percent": {
            "description": "2 for 2 %",
            "examples": [
              1270.92
            ],
            "format": "decimal",
            "title": "Percent",
            "type": "number"
          }
        },
        "required": [
          "days",
          "percent"
        ],
        "title": "EarlyPaymentDiscount",
        "type": "object"
      },
      "Fact": {
        "properties": {
          "amount": {
            "anyOf": [
              {
                "description": "An exact decimal of at most 15 significant digits. Parse it as a decimal type before calculating",
                "examples": [
                  1270.92
                ],
                "format": "decimal",
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Amount"
          },
          "currency": {
            "anyOf": [
              {
                "examples": [
                  "EUR"
                ],
                "pattern": "^[A-Z]{3}$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "ISO 4217, of `amount`",
            "title": "Currency"
          },
          "date": {
            "anyOf": [
              {
                "format": "date",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Date"
          },
          "kind": {
            "$ref": "#/components/schemas/FactKind"
          },
          "label": {
            "description": "What it is, in the document's words",
            "title": "Label",
            "type": "string"
          },
          "number": {
            "anyOf": [
              {
                "description": "An exact decimal of at most 15 significant digits. Parse it as a decimal type before calculating",
                "examples": [
                  1270.92
                ],
                "format": "decimal",
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Number"
          },
          "page": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Page"
          },
          "text": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Text"
          }
        },
        "required": [
          "label",
          "kind"
        ],
        "title": "Fact",
        "type": "object"
      },
      "FactKind": {
        "description": "What a fact on a document's card is.\n\n- `deadline`: A date something is due by; its label says what\n- `valid_from`: The day it is valid from\n- `valid_until`: The day it is valid until\n- `reference`: A number naming something else\n- `amount`: An amount\n- `party`: Someone besides its issuer and recipient\n- `date`: Any other date: an inspection, an acceptance\n- `other`: Anything else",
        "enum": [
          "deadline",
          "valid_from",
          "valid_until",
          "reference",
          "amount",
          "party",
          "date",
          "other"
        ],
        "title": "FactKind",
        "type": "string"
      },
      "Factor": {
        "description": "Who the receivable is assigned or sold to.",
        "properties": {
          "name": {
            "description": "As the assignment note prints it",
            "title": "Name",
            "type": "string"
          }
        },
        "required": [
          "name"
        ],
        "title": "Factor",
        "type": "object"
      },
      "FieldError": {
        "description": "One invalid field of a request.",
        "properties": {
          "loc": {
            "items": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "integer"
                }
              ]
            },
            "title": "Loc",
            "type": "array"
          },
          "msg": {
            "title": "Msg",
            "type": "string"
          },
          "type": {
            "title": "Type",
            "type": "string"
          }
        },
        "required": [
          "loc",
          "msg",
          "type"
        ],
        "title": "FieldError",
        "type": "object"
      },
      "FileCompany": {
        "description": "The business a file waiting for its company belongs to.",
        "properties": {
          "business_id": {
            "description": "One of the businesses the key reaches (`GET /businesses`)",
            "format": "uuid",
            "title": "Business Id",
            "type": "string"
          }
        },
        "required": [
          "business_id"
        ],
        "title": "FileCompany",
        "type": "object"
      },
      "FileStatus": {
        "description": "How far Ocost is with a file.\n\n- `received`: Stored, not read yet\n- `reading`: Being read\n- `read`: Read: `documents` lists what it holds\n- `not_read`: Stored, not read; `reason` says why\n- `failed`: Ocost couldn't read it; `reason` says why\n- `needs_company`: Read, but its document names none of your group's companies or several: `candidates` lists them; `PATCH` it with the `business_id` it belongs to, or someone answers in Ocost",
        "enum": [
          "received",
          "reading",
          "read",
          "not_read",
          "failed",
          "needs_company"
        ],
        "title": "FileStatus",
        "type": "string"
      },
      "FoundBy": {
        "description": "How a passage was found.\n\n- `words`: By its words\n- `meaning`: By its meaning\n- `both`: By both",
        "enum": [
          "words",
          "meaning",
          "both"
        ],
        "title": "FoundBy",
        "type": "string"
      },
      "FoundFact": {
        "properties": {
          "label": {
            "title": "Label",
            "type": "string"
          },
          "text": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Text"
          }
        },
        "required": [
          "label"
        ],
        "title": "FoundFact",
        "type": "object"
      },
      "Hit": {
        "properties": {
          "found_by": {
            "$ref": "#/components/schemas/FoundBy"
          },
          "highlights": {
            "description": "Where the words are in `text`: [start, end) character ranges",
            "items": {
              "maxItems": 2,
              "minItems": 2,
              "prefixItems": [
                {
                  "type": "integer"
                },
                {
                  "type": "integer"
                }
              ],
              "type": "array"
            },
            "title": "Highlights",
            "type": "array"
          },
          "page": {
            "title": "Page",
            "type": "integer"
          },
          "text": {
            "title": "Text",
            "type": "string"
          }
        },
        "required": [
          "page",
          "text",
          "highlights",
          "found_by"
        ],
        "title": "Hit",
        "type": "object"
      },
      "IdentifierScheme": {
        "description": "What an identifier of a party is.\n\n- `UA_EDRPOU`: Ukraine: a legal entity's code ЄДРПОУ, 8 digits\n- `UA_RNOKPP`: Ukraine: a person's or sole trader's (ФОП) РНОКПП, 10 digits\n- `UA_IPN`: Ukraine: the VAT payer's number ІПН, 12 digits\n- `EU_VAT`: A VAT ID with its country prefix (also `vat_id`)\n- `DE_STNR`: Germany: a tax number, Steuernummer\n- `COMMERCIAL_REGISTER`: A register entry with its court (HRB 1234)\n- `PL_NIP`: Poland: NIP, 10 digits\n- `PL_REGON`: Poland: REGON, 9 or 14 digits\n- `PL_KRS`: Poland: KRS number, 10 digits\n- `GB_CRN`: UK: Companies House number, 8 digits or 2 letters and 6\n- `FR_SIREN`: France: SIREN, 9 digits\n- `FR_SIRET`: France: SIRET, 14 digits\n- `CZ_ICO`: Czechia: IČO, 8 digits\n- `RO_CUI`: Romania: CUI, 2 to 10 digits\n- `NO_ORGNR`: Norway: organisasjonsnummer, 9 digits\n- `FI_YTUNNUS`: Finland: Y-tunnus, 8 digits (without its dash)\n- `US_EIN`: United States: EIN, 9 digits\n- `US_STATE_FILE`: United States: a state's entity or file number\n- `MD_IDNO`: Moldova: IDNO, 13 digits\n- `MD_IDNP`: Moldova: a person's IDNP, 13 digits\n- `MD_VAT`: Moldova: cod TVA, 7 digits\n- `OTHER`: Any other number that identifies the party",
        "enum": [
          "UA_EDRPOU",
          "UA_RNOKPP",
          "UA_IPN",
          "EU_VAT",
          "DE_STNR",
          "COMMERCIAL_REGISTER",
          "PL_NIP",
          "PL_REGON",
          "PL_KRS",
          "GB_CRN",
          "FR_SIREN",
          "FR_SIRET",
          "CZ_ICO",
          "RO_CUI",
          "NO_ORGNR",
          "FI_YTUNNUS",
          "US_EIN",
          "US_STATE_FILE",
          "MD_IDNO",
          "MD_IDNP",
          "MD_VAT",
          "OTHER"
        ],
        "title": "IdentifierScheme",
        "type": "string"
      },
      "Kind": {
        "description": "What a document is, grouped so an integrator branches on few; the exact kind is `kind_detail`.\n\n- `invoice`: An invoice to pay: partial, final, advance, collective, recurring, self-billed (`type_code` says which)\n- `credit_note`: A credit note\n- `invoice_correction`: A corrected invoice\n- `receipt`: A receipt: paid already\n- `pro_forma`: A pro forma invoice: not to pay\n- `delivery_note`: A delivery note\n- `order`: An order: a purchase, service, work or project order\n- `order_confirmation`: An order's or a reservation's confirmation\n- `quote`: A quote (offer)\n- `contract`: A contract: agreements, leases, insurance policies, mandates\n- `statement`: A factor's statement\n- `payment_reminder`: A payment reminder\n- `tax_invoice`: A tax invoice registered with the tax authority (a Ukrainian податкова накладна): VAT evidence, not to pay\n- `other`: Anything else: `kind_detail` and `card` say what",
        "enum": [
          "invoice",
          "credit_note",
          "invoice_correction",
          "receipt",
          "pro_forma",
          "delivery_note",
          "order",
          "order_confirmation",
          "quote",
          "contract",
          "statement",
          "payment_reminder",
          "tax_invoice",
          "other"
        ],
        "title": "Kind",
        "type": "string"
      },
      "KindDetail": {
        "description": "The exact kind, one of Ocost's document types, for information: branch on `kind`, which groups them (the guide's reference lists which).",
        "enum": [
          "acceptance_protocol",
          "agreement",
          "bonus_payment_notification",
          "certificate",
          "certificate_of_destruction",
          "collective_invoice",
          "contract",
          "cost_statement",
          "court_order",
          "credit_note",
          "reimbursement",
          "customer_statistics",
          "decision",
          "delivery_note",
          "final_report",
          "lump_sum_overview",
          "test_report",
          "insurance_policy",
          "invoice",
          "invoice_correction",
          "laboratory_report",
          "logistics_appendix",
          "maintenance_log",
          "maintenance_report",
          "mandate",
          "request_for_medical_consultation",
          "notification",
          "offer",
          "order",
          "order_confirmation",
          "order_form",
          "payment_reminder",
          "payroll",
          "pay_slip",
          "prescription",
          "project_order",
          "work_record",
          "receipt",
          "recommendation",
          "lease_contract",
          "report",
          "inquiry",
          "requirement",
          "reservation_confirmation",
          "separator_sheet",
          "service_order",
          "service_report",
          "service_documentation",
          "declaration",
          "time_sheet",
          "work_order",
          "work_report",
          "recurring_rental_invoice",
          "settlement_amount",
          "electronic_summary",
          "administrative_fee",
          "payment_voucher",
          "pro_forma_invoice",
          "copy_of_invoice",
          "bailiff",
          "membership_fee",
          "statement",
          "enforcement_case",
          "information",
          "fee_invoice",
          "cost_calculation",
          "fee_notice",
          "advance_payment_invoice",
          "invoice_audit",
          "credit_invoice",
          "final_invoice",
          "partial_invoice",
          "annex",
          "direct_debit_advice",
          "process_history",
          "internal_project_information",
          "bank_transaction_report",
          "purchase_order",
          "request_for_quotation",
          "rejection",
          "form",
          "tax_invoice"
        ],
        "title": "KindDetail",
        "type": "string"
      },
      "KnownCompany": {
        "description": "A company of the group a refusal or an answer is about (docs/specs/073\n› The same company): found by its name only, so a person decides.",
        "properties": {
          "id": {
            "title": "Id",
            "type": "string"
          },
          "name": {
            "title": "Name",
            "type": "string"
          },
          "numbers": {
            "description": "Its numbers as Ocost keeps them",
            "items": {
              "type": "string"
            },
            "title": "Numbers",
            "type": "array"
          }
        },
        "required": [
          "id",
          "name",
          "numbers"
        ],
        "title": "KnownCompany",
        "type": "object"
      },
      "Line": {
        "description": "BG-25.",
        "properties": {
          "attributes": {
            "additionalProperties": {
              "type": "string"
            },
            "description": "What it is, as printed: colour, size, material, brand, …",
            "title": "Attributes",
            "type": "object"
          },
          "backordered_quantity": {
            "anyOf": [
              {
                "description": "An exact decimal of at most 15 significant digits. Parse it as a decimal type before calculating",
                "examples": [
                  1270.92
                ],
                "format": "decimal",
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "description": "Still to come",
            "title": "Backordered Quantity"
          },
          "base_quantity": {
            "anyOf": [
              {
                "description": "An exact decimal of at most 15 significant digits. Parse it as a decimal type before calculating",
                "examples": [
                  1270.92
                ],
                "format": "decimal",
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "description": "BT-149: how many units `price` is for; null: one",
            "title": "Base Quantity"
          },
          "batch": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Its batch (Charge), as printed",
            "title": "Batch"
          },
          "discount_percent": {
            "anyOf": [
              {
                "description": "An exact decimal of at most 15 significant digits. Parse it as a decimal type before calculating",
                "examples": [
                  1270.92
                ],
                "format": "decimal",
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "description": "The line's discount: 5",
            "title": "Discount Percent"
          },
          "gross_amount": {
            "anyOf": [
              {
                "description": "An exact decimal of at most 15 significant digits. Parse it as a decimal type before calculating",
                "examples": [
                  1270.92
                ],
                "format": "decimal",
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "description": "The line's total with VAT, only as printed on it; null when it prints none",
            "title": "Gross Amount"
          },
          "id": {
            "description": "BT-126: its position",
            "title": "Id",
            "type": "string"
          },
          "name": {
            "description": "BT-153",
            "title": "Name",
            "type": "string"
          },
          "net_amount": {
            "anyOf": [
              {
                "description": "An exact decimal of at most 15 significant digits. Parse it as a decimal type before calculating",
                "examples": [
                  1270.92
                ],
                "format": "decimal",
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "description": "BT-131",
            "title": "Net Amount"
          },
          "ordered_quantity": {
            "anyOf": [
              {
                "description": "An exact decimal of at most 15 significant digits. Parse it as a decimal type before calculating",
                "examples": [
                  1270.92
                ],
                "format": "decimal",
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "description": "A delivery note's",
            "title": "Ordered Quantity"
          },
          "price": {
            "anyOf": [
              {
                "description": "An exact decimal of at most 15 significant digits. Parse it as a decimal type before calculating",
                "examples": [
                  1270.92
                ],
                "format": "decimal",
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "description": "BT-146: the net price",
            "title": "Price"
          },
          "pzn": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "A medicine's PZN",
            "title": "Pzn"
          },
          "quantity": {
            "anyOf": [
              {
                "description": "An exact decimal of at most 15 significant digits. Parse it as a decimal type before calculating",
                "examples": [
                  1270.92
                ],
                "format": "decimal",
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "description": "BT-129",
            "title": "Quantity"
          },
          "seller_item_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "BT-155: the article number",
            "title": "Seller Item Id"
          },
          "standard_item_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "BT-157: the GTIN (scheme 0160)",
            "title": "Standard Item Id"
          },
          "tax_amount": {
            "anyOf": [
              {
                "description": "An exact decimal of at most 15 significant digits. Parse it as a decimal type before calculating",
                "examples": [
                  1270.92
                ],
                "format": "decimal",
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "description": "The line's VAT, only as printed on it; null when it prints none",
            "title": "Tax Amount"
          },
          "unit": {
            "anyOf": [
              {
                "examples": [
                  "C62",
                  "XCT"
                ],
                "pattern": "^[0-9A-Z]{2,3}$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "BT-130: UNECE Rec 20 (C62, HUR, KGM) or Rec 21 (XCT); null when none is printed or it is no code",
            "title": "Unit"
          },
          "vat_category": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/VatCategory"
              },
              {
                "type": "null"
              }
            ],
            "description": "BT-151"
          },
          "vat_rate": {
            "anyOf": [
              {
                "description": "An exact decimal of at most 15 significant digits. Parse it as a decimal type before calculating",
                "examples": [
                  1270.92
                ],
                "format": "decimal",
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "description": "BT-152, percent",
            "title": "Vat Rate"
          }
        },
        "required": [
          "id",
          "name",
          "attributes"
        ],
        "title": "Line",
        "type": "object"
      },
      "Means": {
        "description": "How it is paid, as a word.\n\n- `transfer`: A credit transfer (`means_code` 58)\n- `direct_debit`: A direct debit (59)\n- `card`: A card (48)\n- `already_paid`: It says it is paid already (no code)",
        "enum": [
          "transfer",
          "direct_debit",
          "card",
          "already_paid"
        ],
        "title": "Means",
        "type": "string"
      },
      "MeansCode": {
        "description": "BT-81: how it is paid, UNCL 4461.\n\n- `58`: SEPA credit transfer\n- `59`: SEPA direct debit\n- `48`: Bank card",
        "enum": [
          "58",
          "59",
          "48"
        ],
        "title": "MeansCode",
        "type": "string"
      },
      "OtherParty": {
        "properties": {
          "address": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Address"
              },
              {
                "type": "null"
              }
            ],
            "description": "BG-5, BG-8"
          },
          "contact": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Contact"
              },
              {
                "type": "null"
              }
            ],
            "description": "BG-6, BG-9"
          },
          "identifiers": {
            "default": [],
            "description": "Every identifier printed for it, by scheme (BT-29, BT-46 in any country): an ЄДРПОУ, a РНОКПП, an ІПН, a NIP, …",
            "items": {
              "$ref": "#/components/schemas/PartyIdentifier"
            },
            "title": "Identifiers",
            "type": "array"
          },
          "legal_registration_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "BT-30, BT-47: the register entry (HRB …)",
            "title": "Legal Registration Id"
          },
          "name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "BT-27 (seller), BT-44 (buyer)",
            "title": "Name"
          },
          "printed_role": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The words printed for its role",
            "title": "Printed Role"
          },
          "role": {
            "$ref": "#/components/schemas/PartyRole",
            "description": "What it is to the document"
          },
          "tax_registration_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "BT-32: the tax number (Steuernummer)",
            "title": "Tax Registration Id"
          },
          "vat_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "BT-31, BT-48",
            "title": "Vat Id"
          },
          "website": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "As printed: a host, with or without its scheme",
            "title": "Website"
          }
        },
        "required": [
          "role"
        ],
        "title": "OtherParty",
        "type": "object"
      },
      "Party": {
        "properties": {
          "address": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Address"
              },
              {
                "type": "null"
              }
            ],
            "description": "BG-5, BG-8"
          },
          "contact": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Contact"
              },
              {
                "type": "null"
              }
            ],
            "description": "BG-6, BG-9"
          },
          "identifiers": {
            "default": [],
            "description": "Every identifier printed for it, by scheme (BT-29, BT-46 in any country): an ЄДРПОУ, a РНОКПП, an ІПН, a NIP, …",
            "items": {
              "$ref": "#/components/schemas/PartyIdentifier"
            },
            "title": "Identifiers",
            "type": "array"
          },
          "legal_registration_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "BT-30, BT-47: the register entry (HRB …)",
            "title": "Legal Registration Id"
          },
          "name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "BT-27 (seller), BT-44 (buyer)",
            "title": "Name"
          },
          "tax_registration_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "BT-32: the tax number (Steuernummer)",
            "title": "Tax Registration Id"
          },
          "vat_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "BT-31, BT-48",
            "title": "Vat Id"
          },
          "website": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "As printed: a host, with or without its scheme",
            "title": "Website"
          }
        },
        "title": "Party",
        "type": "object"
      },
      "PartyIdentifier": {
        "properties": {
          "scheme": {
            "$ref": "#/components/schemas/IdentifierScheme"
          },
          "valid": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "description": "Its length and check digit hold; false: in doubt, a misread (never matched on); null: its scheme has no check",
            "title": "Valid"
          },
          "value": {
            "description": "Digits only for the schemes of digits, a VAT ID without spaces, any other as printed",
            "title": "Value",
            "type": "string"
          }
        },
        "required": [
          "scheme",
          "value"
        ],
        "title": "PartyIdentifier",
        "type": "object"
      },
      "PartyRole": {
        "description": "What another party is to the document; `printed_role` is its words.\n\n- `seller`: The seller\n- `buyer`: The buyer\n- `invoicee`: Who it is addressed to, when not the buyer (Rechnungsempfänger)\n- `service_recipient`: Who receives the service, when not the buyer (Leistungsempfänger)\n- `payer`: Who pays, when not the buyer\n- `payee`: Who is paid, when not the seller\n- `ship_to`: Where the goods go (Warenempfänger)\n- `carrier`: Who carries the goods\n- `factor`: Who bought the receivable\n- `debtor`: Whose receivable it is (a factor's debtor)\n- `guarantor`: Who guarantees it (Bürge)\n- `landlord`: The landlord\n- `tenant`: The tenant\n- `subtenant`: The subtenant\n- `contractor`: The contractor\n- `subcontractor`: The subcontractor\n- `principal`: Who commissions the work (Auftraggeber, Bauherr)\n- `agent`: Who acts for a party: a property manager, a broker\n- `insurer`: The insurer\n- `policyholder`: The policyholder\n- `other`: Any other role: `printed_role` says which",
        "enum": [
          "seller",
          "buyer",
          "invoicee",
          "service_recipient",
          "payer",
          "payee",
          "ship_to",
          "carrier",
          "factor",
          "debtor",
          "guarantor",
          "landlord",
          "tenant",
          "subtenant",
          "contractor",
          "subcontractor",
          "principal",
          "agent",
          "insurer",
          "policyholder",
          "other"
        ],
        "title": "PartyRole",
        "type": "string"
      },
      "Payment": {
        "description": "BG-16.",
        "properties": {
          "assigned_to": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Factor"
              },
              {
                "type": "null"
              }
            ],
            "description": "The factor its assignment note (Abtretung, Zession, factoring) names; `iban` is then the factor's"
          },
          "bic": {
            "anyOf": [
              {
                "examples": [
                  "BYLADEM1001"
                ],
                "pattern": "^[A-Z]{6}[0-9A-Z]{2}([0-9A-Z]{3})?$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "BT-86",
            "title": "Bic"
          },
          "iban": {
            "anyOf": [
              {
                "examples": [
                  "DE02120300000000202051"
                ],
                "pattern": "^[A-Z]{2}[0-9]{2}[0-9A-Z]{11,30}$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "BT-84, without spaces",
            "title": "Iban"
          },
          "iban_holder": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "BT-85: the holder of `iban`, as printed",
            "title": "Iban Holder"
          },
          "means": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Means"
              },
              {
                "type": "null"
              }
            ],
            "description": "The same, as a word"
          },
          "means_code": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/MeansCode"
              },
              {
                "type": "null"
              }
            ],
            "description": "BT-81, UNCL 4461; null when it doesn't say or it was paid already"
          },
          "net_days": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "description": "The days the terms give to pay in full from the issue date",
            "title": "Net Days"
          },
          "paid_on": {
            "anyOf": [
              {
                "format": "date",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The day it says it was paid or charged, where printed",
            "title": "Paid On"
          },
          "terms": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "BT-20, as printed",
            "title": "Terms"
          }
        },
        "title": "Payment",
        "type": "object"
      },
      "Problem": {
        "description": "RFC 9457 problem details, with `errors` for invalid fields.",
        "properties": {
          "company": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/KnownCompany"
              },
              {
                "type": "null"
              }
            ],
            "description": "reason same_name: the group's company of that name"
          },
          "detail": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Detail"
          },
          "errors": {
            "anyOf": [
              {
                "items": {
                  "$ref": "#/components/schemas/FieldError"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Errors"
          },
          "instance": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Instance"
          },
          "reason": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Read-only (type urn:ocost:read-only, docs/specs/056): why, trial_ended, unpaid or ended; same_name: a company added without a number whose name a company of the group has (`company`)",
            "title": "Reason"
          },
          "renews_on": {
            "anyOf": [
              {
                "format": "date",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "A month's limit used (type urn:ocost:limit:<kind>): the day it renews",
            "title": "Renews On"
          },
          "status": {
            "title": "Status",
            "type": "integer"
          },
          "title": {
            "title": "Title",
            "type": "string"
          },
          "type": {
            "default": "about:blank",
            "title": "Type",
            "type": "string"
          }
        },
        "required": [
          "title",
          "status"
        ],
        "title": "Problem",
        "type": "object"
      },
      "PublicBusiness": {
        "properties": {
          "id": {
            "description": "What `Ocost-Business` names",
            "format": "uuid",
            "title": "Id",
            "type": "string"
          },
          "name": {
            "title": "Name",
            "type": "string"
          },
          "own": {
            "description": "The business the key was made in",
            "title": "Own",
            "type": "boolean"
          }
        },
        "required": [
          "id",
          "name",
          "own"
        ],
        "title": "PublicBusiness",
        "type": "object"
      },
      "PublicBusinesses": {
        "properties": {
          "businesses": {
            "description": "The key's own business first, then the group's others it reaches, by name",
            "items": {
              "$ref": "#/components/schemas/PublicBusiness"
            },
            "title": "Businesses",
            "type": "array"
          }
        },
        "required": [
          "businesses"
        ],
        "title": "PublicBusinesses",
        "type": "object"
      },
      "PublicFile": {
        "description": "A file sent, and how far Ocost is with it.",
        "examples": [
          {
            "business_id": "01a1b08c-0b3e-7d10-8a8c-0d5c3f0e2a01",
            "candidates": [],
            "content_type": "application/pdf",
            "created_at": "2026-11-03T09:12:40Z",
            "documents": [
              {
                "id": "01a1b08c-7aa1-7b52-9d4e-2f1f1c0c4f11",
                "kind": "invoice",
                "number": "RE-2026-1187",
                "pages": [
                  1
                ]
              }
            ],
            "external_ref": "account.move,42",
            "external_refs": [
              "account.move,42"
            ],
            "id": "01a1b08c-6e3a-7562-8f4a-7924722667b1",
            "name": "RE-2026-1187.pdf",
            "pages": 1,
            "routed_by": "vat_id",
            "sha256": "9f2c000000000000000000000000000000000000000000000000000000000000",
            "size_bytes": 48211,
            "status": "read",
            "updated_at": "2026-11-03T09:13:05Z"
          }
        ],
        "properties": {
          "business_id": {
            "description": "The business it is in: the key's own, the one the request named, or the company its document names",
            "format": "uuid",
            "title": "Business Id",
            "type": "string"
          },
          "candidates": {
            "default": [],
            "description": "For `needs_company`: the companies it may belong to",
            "items": {
              "$ref": "#/components/schemas/Candidate"
            },
            "title": "Candidates",
            "type": "array"
          },
          "content_type": {
            "title": "Content Type",
            "type": "string"
          },
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "documents": {
            "description": "Once `read`: what it holds",
            "items": {
              "$ref": "#/components/schemas/DocumentRef"
            },
            "title": "Documents",
            "type": "array"
          },
          "external_ref": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Your own id for it, as first sent",
            "title": "External Ref"
          },
          "external_refs": {
            "description": "Every id you sent with these bytes, the first first, each once; up to 50",
            "items": {
              "type": "string"
            },
            "title": "External Refs",
            "type": "array"
          },
          "id": {
            "format": "uuid",
            "title": "Id",
            "type": "string"
          },
          "name": {
            "title": "Name",
            "type": "string"
          },
          "pages": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "description": "Its pages, once counted",
            "title": "Pages"
          },
          "pages_read": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "description": "The first pages read of a file longer than Ocost reads; null: all of them",
            "title": "Pages Read"
          },
          "reason": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Reason"
              },
              {
                "type": "null"
              }
            ],
            "description": "Why it is `not_read` or `failed`"
          },
          "renews_on": {
            "anyOf": [
              {
                "format": "date",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "For `reason: limit`: the day the month's documents renew; it is read then by itself",
            "title": "Renews On"
          },
          "routed_by": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/RoutedBy"
              },
              {
                "type": "null"
              }
            ],
            "description": "How that business was chosen; null while its document is still being read, for a file not sent through the API, and while it is `needs_company`"
          },
          "sha256": {
            "description": "The bytes' SHA-256, hex: the same bytes are one file; empty for a file Ocost made itself before it is hashed",
            "pattern": "^([0-9a-f]{64})?$",
            "title": "Sha256",
            "type": "string"
          },
          "size_bytes": {
            "title": "Size Bytes",
            "type": "integer"
          },
          "status": {
            "$ref": "#/components/schemas/FileStatus"
          },
          "updated_at": {
            "format": "date-time",
            "title": "Updated At",
            "type": "string"
          }
        },
        "required": [
          "id",
          "name",
          "content_type",
          "size_bytes",
          "sha256",
          "status",
          "external_refs",
          "documents",
          "business_id",
          "created_at",
          "updated_at"
        ],
        "title": "PublicFile",
        "type": "object"
      },
      "PublicFiles": {
        "properties": {
          "files": {
            "description": "Oldest change first",
            "items": {
              "$ref": "#/components/schemas/PublicFile"
            },
            "title": "Files",
            "type": "array"
          },
          "more": {
            "description": "More pages are there now: ask again at once",
            "title": "More",
            "type": "boolean"
          },
          "next_cursor": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Ask with this as `cursor` for the next page, and later for what changed since; null when nothing was listed yet",
            "title": "Next Cursor"
          }
        },
        "required": [
          "files",
          "more"
        ],
        "title": "PublicFiles",
        "type": "object"
      },
      "ReadWith": {
        "description": "How Ocost read it: never a model's or provider's name.\n\n- `e_invoice`: From its XML, exactly\n- `reader`: From its pages",
        "enum": [
          "e_invoice",
          "reader"
        ],
        "title": "ReadWith",
        "type": "string"
      },
      "Reason": {
        "description": "Why a file is `not_read` or `failed`.\n\n- `limit`: The month's documents are used up; read on `renews_on`\n- `model_off`: This business may not have PDFs and images read; e-invoices still are\n- `nothing_found`: No document in it\n- `too_large`: Too many pages or too large an image\n- `damaged`: Not a file Ocost can open\n- `unavailable`: No reading service answered for a day; send it again\n- `failed`: Reading failed\n- `other`: Any other reason",
        "enum": [
          "limit",
          "model_off",
          "nothing_found",
          "too_large",
          "damaged",
          "unavailable",
          "failed",
          "other"
        ],
        "title": "Reason",
        "type": "string"
      },
      "RoutedBy": {
        "description": "How the business a file is in was chosen.\n\n- `header`: The request named it (`Ocost-Business`)\n- `vat_id`: Its document names that company's VAT ID (or ІПН, NIP)\n- `tax_number`: Its document names that company's tax number\n- `edrpou`: Its document names that company's ЄДРПОУ or РНОКПП\n- `register`: Its document names that company's register number and court\n- `iban`: Its document asks to be paid into that company's account\n- `home`: The key's own business: its document names no other of the group\n- `person`: Chosen after Ocost asked, in Ocost or with `PATCH`",
        "enum": [
          "header",
          "vat_id",
          "tax_number",
          "edrpou",
          "register",
          "iban",
          "home",
          "person"
        ],
        "title": "RoutedBy",
        "type": "string"
      },
      "SearchMeaning": {
        "description": "Whether search by meaning answered.\n\n- `available`: It did\n- `unavailable`: The index is building or its model unreachable; the words still answer",
        "enum": [
          "available",
          "unavailable"
        ],
        "title": "SearchMeaning",
        "type": "string"
      },
      "SearchResult": {
        "properties": {
          "buyer": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "As read",
            "title": "Buyer"
          },
          "currency": {
            "anyOf": [
              {
                "examples": [
                  "EUR"
                ],
                "pattern": "^[A-Z]{3}$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Currency"
          },
          "document_id": {
            "anyOf": [
              {
                "format": "uuid",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Null for a file without one",
            "title": "Document Id"
          },
          "document_url": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The document, in this API",
            "title": "Document Url"
          },
          "facts": {
            "description": "Its card's facts that have the words",
            "items": {
              "$ref": "#/components/schemas/FoundFact"
            },
            "title": "Facts",
            "type": "array"
          },
          "file_id": {
            "format": "uuid",
            "title": "File Id",
            "type": "string"
          },
          "file_name": {
            "title": "File Name",
            "type": "string"
          },
          "file_url": {
            "description": "The file, in this API",
            "title": "File Url",
            "type": "string"
          },
          "gross": {
            "anyOf": [
              {
                "description": "An exact decimal of at most 15 significant digits. Parse it as a decimal type before calculating",
                "examples": [
                  1270.92
                ],
                "format": "decimal",
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Gross"
          },
          "issue_date": {
            "anyOf": [
              {
                "format": "date",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Issue Date"
          },
          "kind": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Kind"
              },
              {
                "type": "null"
              }
            ]
          },
          "number": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Number"
          },
          "pages": {
            "items": {
              "type": "integer"
            },
            "title": "Pages",
            "type": "array"
          },
          "passages": {
            "description": "At most 5, best first",
            "items": {
              "$ref": "#/components/schemas/Hit"
            },
            "title": "Passages",
            "type": "array"
          },
          "seller": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "As read",
            "title": "Seller"
          }
        },
        "required": [
          "file_id",
          "file_name",
          "pages",
          "passages",
          "facts",
          "file_url"
        ],
        "title": "SearchResult",
        "type": "object"
      },
      "SearchResults": {
        "properties": {
          "meaning": {
            "$ref": "#/components/schemas/SearchMeaning"
          },
          "results": {
            "items": {
              "$ref": "#/components/schemas/SearchResult"
            },
            "title": "Results",
            "type": "array"
          },
          "total": {
            "description": "How many matched, up to the pool's 300",
            "title": "Total",
            "type": "integer"
          },
          "truncated": {
            "description": "More matched than the pool holds",
            "title": "Truncated",
            "type": "boolean"
          }
        },
        "required": [
          "results",
          "total",
          "truncated",
          "meaning"
        ],
        "title": "SearchResults",
        "type": "object"
      },
      "Source": {
        "description": "Where a value was read, and how sure Ocost is of it.",
        "properties": {
          "box": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Box"
              },
              {
                "type": "null"
              }
            ],
            "description": "Its rectangle on `page`; null when Ocost kept none (then `quote` is all there is)"
          },
          "confidence": {
            "$ref": "#/components/schemas/Confidence"
          },
          "page": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "description": "Where it was read: the file's page, from 1",
            "title": "Page"
          },
          "quote": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The words it was read from",
            "title": "Quote"
          },
          "why": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "For a doubt: the failed check's `name`",
            "title": "Why"
          }
        },
        "required": [
          "confidence"
        ],
        "title": "Source",
        "type": "object"
      },
      "TaxCase": {
        "description": "Which German rules an incoming invoice is held to.\n\n- `standard`: § 14 Abs. 4 UStG: an invoice with VAT\n- `small`: § 33 UStDV: a small amount, up to 250 €\n- `reverse_charge`: § 13b, § 14a Abs. 5 UStG: the business owes the VAT\n- `intra_eu`: § 14a Abs. 3 UStG: an intra-community supply\n- `exempt`: § 14 Abs. 4 Satz 1 Nr. 8 UStG: an exempt supply",
        "enum": [
          "standard",
          "small",
          "reverse_charge",
          "intra_eu",
          "exempt"
        ],
        "title": "TaxCase",
        "type": "string"
      },
      "TaxCheck": {
        "description": "An incoming invoice's § 14 UStG check (Germany's rules).",
        "properties": {
          "case": {
            "$ref": "#/components/schemas/TaxCase"
          },
          "missing": {
            "items": {
              "$ref": "#/components/schemas/TaxItem"
            },
            "title": "Missing",
            "type": "array"
          }
        },
        "required": [
          "case",
          "missing"
        ],
        "title": "TaxCheck",
        "type": "object"
      },
      "TaxItem": {
        "properties": {
          "at_stake": {
            "description": "Missing, it costs the input VAT deduction",
            "title": "At Stake",
            "type": "boolean"
          },
          "item": {
            "$ref": "#/components/schemas/TaxItemKind"
          },
          "law": {
            "description": "The paragraph that asks for it",
            "title": "Law",
            "type": "string"
          }
        },
        "required": [
          "item",
          "law",
          "at_stake"
        ],
        "title": "TaxItem",
        "type": "object"
      },
      "TaxItemKind": {
        "description": "What an invoice lacks, or has wrong, for its case.\n\n- `supplier_name`: The supplier's full name\n- `supplier_address`: The supplier's full address\n- `supplier_tax_id`: The supplier's tax number or VAT ID\n- `recipient_name`: The recipient's full name\n- `recipient_address`: The recipient's full address\n- `recipient_not_us`: It is addressed to someone else than the business\n- `recipient_address_not_ours`: It is addressed to an address that isn't the business's\n- `issued_on`: The issue date\n- `number`: The invoice number\n- `description`: The quantity and kind of the goods or services\n- `service_date`: The day of the supply or service\n- `net`: The net per rate\n- `tax_rate`: The VAT rate\n- `tax_amount`: The VAT\n- `exemption_note`: The note on why it is exempt\n- `reverse_charge_note`: The note that the recipient owes the VAT (Steuerschuldnerschaft des Leistungsempfängers)\n- `intra_eu_note`: The note that it is an intra-community supply\n- `supplier_vat_id`: The supplier's VAT ID\n- `recipient_vat_id`: The recipient's VAT ID\n- `vat_charged`: German VAT charged where the business owes it itself (§ 13b): not deductible, and paying it pays VAT twice\n- `vat_non_payer`: Ukraine: ПДВ charged by a supplier Ukraine's register says is no VAT payer (платник ПДВ): no tax credit for it\n- `supplier_idno`: Moldova: the supplier's IDNO\n- `supplier_vat_code`: Moldova: the supplier's VAT code (cod TVA), where it charges VAT\n- `vat_rate_unknown`: Moldova: a VAT rate other than 20 %, 8 % or 0 %",
        "enum": [
          "supplier_name",
          "supplier_address",
          "supplier_tax_id",
          "recipient_name",
          "recipient_address",
          "recipient_not_us",
          "recipient_address_not_ours",
          "issued_on",
          "number",
          "description",
          "service_date",
          "net",
          "tax_rate",
          "tax_amount",
          "exemption_note",
          "reverse_charge_note",
          "intra_eu_note",
          "supplier_vat_id",
          "recipient_vat_id",
          "vat_charged",
          "vat_non_payer",
          "supplier_idno",
          "supplier_vat_code",
          "vat_rate_unknown"
        ],
        "title": "TaxItemKind",
        "type": "string"
      },
      "TaxRegistration": {
        "description": "Where the tax authority registered a tax invoice (Ukraine's ЄРПН).",
        "properties": {
          "date": {
            "anyOf": [
              {
                "format": "date",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The day it was registered",
            "title": "Date"
          },
          "number": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Its registration number",
            "title": "Number"
          }
        },
        "title": "TaxRegistration",
        "type": "object"
      },
      "Totals": {
        "description": "BG-22.",
        "properties": {
          "gross": {
            "anyOf": [
              {
                "description": "An exact decimal of at most 15 significant digits. Parse it as a decimal type before calculating",
                "examples": [
                  1270.92
                ],
                "format": "decimal",
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "description": "BT-112",
            "title": "Gross"
          },
          "net": {
            "anyOf": [
              {
                "description": "An exact decimal of at most 15 significant digits. Parse it as a decimal type before calculating",
                "examples": [
                  1270.92
                ],
                "format": "decimal",
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "description": "BT-109",
            "title": "Net"
          },
          "payable": {
            "anyOf": [
              {
                "description": "An exact decimal of at most 15 significant digits. Parse it as a decimal type before calculating",
                "examples": [
                  1270.92
                ],
                "format": "decimal",
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "description": "BT-115: what is left to pay; null when it is the gross",
            "title": "Payable"
          },
          "prices_include_vat": {
            "description": "Its lines' prices and amounts include VAT (a receipt)",
            "title": "Prices Include Vat",
            "type": "boolean"
          },
          "tax": {
            "anyOf": [
              {
                "description": "An exact decimal of at most 15 significant digits. Parse it as a decimal type before calculating",
                "examples": [
                  1270.92
                ],
                "format": "decimal",
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "description": "BT-110",
            "title": "Tax"
          }
        },
        "required": [
          "prices_include_vat"
        ],
        "title": "Totals",
        "type": "object"
      },
      "VatCategory": {
        "description": "BT-118, BT-151: the VAT category, UNCL 5305 as EN 16931 uses it.\n\n- `S`: Standard rate\n- `Z`: Zero rated goods\n- `E`: Exempt from VAT\n- `AE`: Reverse charge: the buyer owes the VAT\n- `K`: Intra-community supply, VAT exempt\n- `G`: Export outside the EU, free of VAT\n- `O`: Outside the scope of VAT\n- `L`: Canary Islands' IGIC\n- `M`: Ceuta and Melilla's IPSI\n- `B`: Transferred VAT (Italy's split payment)",
        "enum": [
          "S",
          "Z",
          "E",
          "AE",
          "K",
          "G",
          "O",
          "L",
          "M",
          "B"
        ],
        "title": "VatCategory",
        "type": "string"
      },
      "VatGroup": {
        "description": "BG-23.",
        "properties": {
          "category": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/VatCategory"
              },
              {
                "type": "null"
              }
            ],
            "description": "BT-118"
          },
          "exemption_reason": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "BT-120",
            "title": "Exemption Reason"
          },
          "rate": {
            "anyOf": [
              {
                "description": "An exact decimal of at most 15 significant digits. Parse it as a decimal type before calculating",
                "examples": [
                  1270.92
                ],
                "format": "decimal",
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "description": "BT-119, percent: 19",
            "title": "Rate"
          },
          "tax_amount": {
            "description": "BT-117",
            "examples": [
              1270.92
            ],
            "format": "decimal",
            "title": "Tax Amount",
            "type": "number"
          },
          "taxable_amount": {
            "description": "BT-116",
            "examples": [
              1270.92
            ],
            "format": "decimal",
            "title": "Taxable Amount",
            "type": "number"
          }
        },
        "required": [
          "taxable_amount",
          "tax_amount"
        ],
        "title": "VatGroup",
        "type": "object"
      },
      "WorkedOut": {
        "description": "An amount Ocost worked out because the one read can't be it.",
        "properties": {
          "field": {
            "$ref": "#/components/schemas/WorkedOutField",
            "description": "Its path in this document"
          },
          "printed": {
            "anyOf": [
              {
                "description": "An exact decimal of at most 15 significant digits. Parse it as a decimal type before calculating",
                "examples": [
                  1270.92
                ],
                "format": "decimal",
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "description": "What was read",
            "title": "Printed"
          },
          "rule": {
            "$ref": "#/components/schemas/WorkedOutRule"
          }
        },
        "required": [
          "field",
          "rule"
        ],
        "title": "WorkedOut",
        "type": "object"
      },
      "WorkedOutField": {
        "description": "The amount worked out, by its path.\n\n- `totals.net`: BT-109\n- `totals.tax`: BT-110\n- `totals.gross`: BT-112",
        "enum": [
          "totals.net",
          "totals.tax",
          "totals.gross"
        ],
        "title": "WorkedOutField",
        "type": "string"
      },
      "WorkedOutRule": {
        "description": "How Ocost worked an amount out.\n\n- `groups`: The VAT groups' sum\n- `net_tax`: Net plus VAT\n- `skonto`: The gross read was the amount less Skonto\n- `payable`: The gross read was what is left to pay\n- `outside`: The net with an amount outside the VAT groups: a deposit, a tip\n- `tip`: The gross read was the amount paid: the bill and its tip, read apart",
        "enum": [
          "groups",
          "net_tax",
          "skonto",
          "payable",
          "outside",
          "tip"
        ],
        "title": "WorkedOutRule",
        "type": "string"
      }
    },
    "securitySchemes": {
      "ApiKey": {
        "description": "An Ocost API key: `Authorization: Bearer ocost_sk_…`",
        "scheme": "bearer",
        "type": "http"
      }
    }
  },
  "info": {
    "description": "Ocost reads business documents (invoices, credit notes,\nreceipts, delivery notes, orders, contracts, …) and finds them again by what\nthey say. Send a file, poll it until it is read, take its document as\n`ocost.document.v1`, search everything sent.\n\nEvery request carries a business's API key: `Authorization: Bearer\nocost_sk_…`, made in Ocost under Settings › API. Errors are RFC 9457\nproblems (`application/problem+json`) with a stable `type`. The guides:\nhttps://ocost.io/docs\n\nFor AI assistants and tools: https://ocost.io/docs/llms.txt lists every guide\nas Markdown, https://ocost.io/docs/llms-full.txt holds them all in one file,\nand this document is at https://ocost.io/docs/openapi.json.",
    "title": "Ocost API",
    "version": "1"
  },
  "openapi": "3.1.0",
  "paths": {
    "/businesses": {
      "get": {
        "description": "The businesses this key reaches: its own first, then the others of\nits group its owner gave it, by name. A request names the one it acts\nin with `Ocost-Business` (docs/specs/074 › API keys across companies).\nAny scope; 60 calls a minute.",
        "operationId": "list_businesses",
        "parameters": [
          {
            "description": "The business this request acts in, by its id: one of your group's that the key reaches (403 `urn:ocost:key:business` otherwise). Without it, the business the key was made in; a file sent without it by a key that reaches several goes to the company its document names (`routed_by`), and a file is found in whichever of them it went to.",
            "in": "header",
            "name": "Ocost-Business",
            "required": false,
            "schema": {
              "description": "The business this request acts in, by its id: one of your group's that the key reaches (403 `urn:ocost:key:business` otherwise). Without it, the business the key was made in; a file sent without it by a key that reaches several goes to the company its document names (`routed_by`), and a file is found in whichever of them it went to.",
              "title": "Ocost-Business",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicBusinesses"
                }
              }
            },
            "description": "Successful Response"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              },
              "application/problem+json": {}
            },
            "description": "Bad Request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              },
              "application/problem+json": {}
            },
            "description": "Unauthorized"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              },
              "application/problem+json": {}
            },
            "description": "Forbidden"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              },
              "application/problem+json": {}
            },
            "description": "Not Found"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              },
              "application/problem+json": {}
            },
            "description": "Unprocessable Content"
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              },
              "application/problem+json": {}
            },
            "description": "Too Many Requests"
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              },
              "application/problem+json": {}
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "ApiKey": []
          }
        ],
        "summary": "List Businesses"
      }
    },
    "/documents/{document_id}": {
      "get": {
        "description": "One document as `ocost.document.v1`.",
        "operationId": "get_document",
        "parameters": [
          {
            "description": "A document's `id`: from a file's `documents` or a search result",
            "in": "path",
            "name": "document_id",
            "required": true,
            "schema": {
              "description": "A document's `id`: from a file's `documents` or a search result",
              "format": "uuid",
              "title": "Document Id",
              "type": "string"
            }
          },
          {
            "description": "The business this request acts in, by its id: one of your group's that the key reaches (403 `urn:ocost:key:business` otherwise). Without it, the business the key was made in; a file sent without it by a key that reaches several goes to the company its document names (`routed_by`), and a file is found in whichever of them it went to.",
            "in": "header",
            "name": "Ocost-Business",
            "required": false,
            "schema": {
              "description": "The business this request acts in, by its id: one of your group's that the key reaches (403 `urn:ocost:key:business` otherwise). Without it, the business the key was made in; a file sent without it by a key that reaches several goes to the company its document names (`routed_by`), and a file is found in whichever of them it went to.",
              "title": "Ocost-Business",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Document"
                }
              }
            },
            "description": "Successful Response"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              },
              "application/problem+json": {}
            },
            "description": "Bad Request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              },
              "application/problem+json": {}
            },
            "description": "Unauthorized"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              },
              "application/problem+json": {}
            },
            "description": "Forbidden"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              },
              "application/problem+json": {}
            },
            "description": "Not Found"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              },
              "application/problem+json": {}
            },
            "description": "Unprocessable Content"
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              },
              "application/problem+json": {}
            },
            "description": "Too Many Requests"
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              },
              "application/problem+json": {}
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "ApiKey": []
          }
        ],
        "summary": "Get Document"
      }
    },
    "/files": {
      "get": {
        "description": "The files changed at or after `updated_since`, oldest change first,\nof the statuses asked for, carrying `external_ref` when it is given:\nwhat a connector polls. The next page is `next_cursor`'s; with no more,\nkeep the last cursor and ask with it later for what changed since. A\nchange made as a page is read comes on a later one. A key that reaches\nseveral businesses of a group and names none (`Ocost-Business`) lists\nits own business's files and those it sent that went to the others\n(`business_id` says where each is).",
        "operationId": "list_files",
        "parameters": [
          {
            "description": "Only files of these statuses; repeat it for several",
            "in": "query",
            "name": "status",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "items": {
                    "$ref": "#/components/schemas/FileStatus"
                  },
                  "type": "array"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Only files of these statuses; repeat it for several",
              "title": "Status"
            }
          },
          {
            "description": "Files changed at or after this time (ISO 8601)",
            "in": "query",
            "name": "updated_since",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "format": "date-time",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Files changed at or after this time (ISO 8601)",
              "title": "Updated Since"
            }
          },
          {
            "description": "Only the files carrying this reference among their `external_refs` (exactly)",
            "in": "query",
            "name": "external_ref",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 200,
                  "minLength": 1,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Only the files carrying this reference among their `external_refs` (exactly)",
              "title": "External Ref"
            }
          },
          {
            "description": "`next_cursor` of the page before",
            "in": "query",
            "name": "cursor",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 200,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "`next_cursor` of the page before",
              "title": "Cursor"
            }
          },
          {
            "description": "Files per page",
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "default": 50,
              "description": "Files per page",
              "maximum": 100,
              "minimum": 1,
              "title": "Limit",
              "type": "integer"
            }
          },
          {
            "description": "Only the files in this business, one the key reaches (`GET /businesses`)",
            "in": "query",
            "name": "business_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "format": "uuid",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Only the files in this business, one the key reaches (`GET /businesses`)",
              "title": "Business Id"
            }
          },
          {
            "description": "The business this request acts in, by its id: one of your group's that the key reaches (403 `urn:ocost:key:business` otherwise). Without it, the business the key was made in; a file sent without it by a key that reaches several goes to the company its document names (`routed_by`), and a file is found in whichever of them it went to.",
            "in": "header",
            "name": "Ocost-Business",
            "required": false,
            "schema": {
              "description": "The business this request acts in, by its id: one of your group's that the key reaches (403 `urn:ocost:key:business` otherwise). Without it, the business the key was made in; a file sent without it by a key that reaches several goes to the company its document names (`routed_by`), and a file is found in whichever of them it went to.",
              "title": "Ocost-Business",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicFiles"
                }
              }
            },
            "description": "Successful Response"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              },
              "application/problem+json": {}
            },
            "description": "Bad Request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              },
              "application/problem+json": {}
            },
            "description": "Unauthorized"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              },
              "application/problem+json": {}
            },
            "description": "Forbidden"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              },
              "application/problem+json": {}
            },
            "description": "Not Found"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              },
              "application/problem+json": {}
            },
            "description": "Unprocessable Content"
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              },
              "application/problem+json": {}
            },
            "description": "Too Many Requests"
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              },
              "application/problem+json": {}
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "ApiKey": []
          }
        ],
        "summary": "List Files"
      },
      "post": {
        "description": "Sends a file to be read (multipart, field `file`): 202 with the file,\n`received`, when it is new; 200 with the file as it is when the same\nbytes were sent before (they are read and counted once; a new\n`external_ref` is kept beside the ones before, in `external_refs`).\nEach answer says the month's documents left in\n`X-Ocost-Documents-Left`. 413 past 25 MB, 415 for a kind Ocost doesn't\nread (an archive among them), 409 when the same bytes are a file of the\nbusiness the key doesn't see (a person's own upload), 422 for a 51st\nreference.",
        "operationId": "send_file",
        "parameters": [
          {
            "description": "The business this request acts in, by its id: one of your group's that the key reaches (403 `urn:ocost:key:business` otherwise). Without it, the business the key was made in; a file sent without it by a key that reaches several goes to the company its document names (`routed_by`), and a file is found in whichever of them it went to.",
            "in": "header",
            "name": "Ocost-Business",
            "required": false,
            "schema": {
              "description": "The business this request acts in, by its id: one of your group's that the key reaches (403 `urn:ocost:key:business` otherwise). Without it, the business the key was made in; a file sent without it by a key that reaches several goes to the company its document names (`routed_by`), and a file is found in whichever of them it went to.",
              "title": "Ocost-Business",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "multipart/form-data": {
              "schema": {
                "properties": {
                  "external_ref": {
                    "description": "Your own id for it (an Odoo bill's), kept and given back; the same bytes sent again with another keep it too (`external_refs`, up to 50)",
                    "maxLength": 200,
                    "type": "string"
                  },
                  "file": {
                    "description": "A PDF, an image (JPEG, PNG, TIFF, WebP), a Word file (.docx, .doc) or an e-invoice's XML (XRechnung, UBL, CII); at most 25 MB",
                    "format": "binary",
                    "type": "string"
                  },
                  "name": {
                    "description": "Its file name; the upload's own when left out",
                    "maxLength": 255,
                    "type": "string"
                  }
                },
                "required": [
                  "file"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicFile"
                }
              }
            },
            "description": "The same bytes, sent before"
          },
          "202": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicFile"
                }
              }
            },
            "description": "Successful Response"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              },
              "application/problem+json": {}
            },
            "description": "Bad Request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              },
              "application/problem+json": {}
            },
            "description": "Unauthorized"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              },
              "application/problem+json": {}
            },
            "description": "Forbidden"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              },
              "application/problem+json": {}
            },
            "description": "Not Found"
          },
          "411": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              },
              "application/problem+json": {}
            },
            "description": "Length Required"
          },
          "413": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              },
              "application/problem+json": {}
            },
            "description": "Content Too Large"
          },
          "415": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              },
              "application/problem+json": {}
            },
            "description": "Unsupported Media Type"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              },
              "application/problem+json": {}
            },
            "description": "Unprocessable Content"
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              },
              "application/problem+json": {}
            },
            "description": "Too Many Requests"
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              },
              "application/problem+json": {}
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "ApiKey": []
          }
        ],
        "summary": "Send File"
      }
    },
    "/files/{file_id}": {
      "delete": {
        "description": "Erases the file for good, at once: its documents, their lines,\nsources and parties, its passages and its reading, and the original in\nstorage. 409 while it is being read (`urn:ocost:file:reading`), and while\nOcost still needs it as Files would keep it: an invoice paid, matched or\nexported, a bank statement, an open question, a project's file\n(`urn:ocost:file:linked`, the reason in `detail`); 404 after.",
        "operationId": "delete_file",
        "parameters": [
          {
            "description": "The file's `id`, as `POST /files` answered it",
            "in": "path",
            "name": "file_id",
            "required": true,
            "schema": {
              "description": "The file's `id`, as `POST /files` answered it",
              "format": "uuid",
              "title": "File Id",
              "type": "string"
            }
          },
          {
            "description": "The business this request acts in, by its id: one of your group's that the key reaches (403 `urn:ocost:key:business` otherwise). Without it, the business the key was made in; a file sent without it by a key that reaches several goes to the company its document names (`routed_by`), and a file is found in whichever of them it went to.",
            "in": "header",
            "name": "Ocost-Business",
            "required": false,
            "schema": {
              "description": "The business this request acts in, by its id: one of your group's that the key reaches (403 `urn:ocost:key:business` otherwise). Without it, the business the key was made in; a file sent without it by a key that reaches several goes to the company its document names (`routed_by`), and a file is found in whichever of them it went to.",
              "title": "Ocost-Business",
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Successful Response"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              },
              "application/problem+json": {}
            },
            "description": "Bad Request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              },
              "application/problem+json": {}
            },
            "description": "Unauthorized"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              },
              "application/problem+json": {}
            },
            "description": "Forbidden"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              },
              "application/problem+json": {}
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              },
              "application/problem+json": {}
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              },
              "application/problem+json": {}
            },
            "description": "Unprocessable Content"
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              },
              "application/problem+json": {}
            },
            "description": "Too Many Requests"
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              },
              "application/problem+json": {}
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "ApiKey": []
          }
        ],
        "summary": "Delete File"
      },
      "get": {
        "description": "A file: its status, why it isn't read where it isn't, and the\ndocuments it holds once it is; the business it is in, and how that was\nchosen.",
        "operationId": "get_file",
        "parameters": [
          {
            "description": "The file's `id`, as `POST /files` answered it",
            "in": "path",
            "name": "file_id",
            "required": true,
            "schema": {
              "description": "The file's `id`, as `POST /files` answered it",
              "format": "uuid",
              "title": "File Id",
              "type": "string"
            }
          },
          {
            "description": "The business this request acts in, by its id: one of your group's that the key reaches (403 `urn:ocost:key:business` otherwise). Without it, the business the key was made in; a file sent without it by a key that reaches several goes to the company its document names (`routed_by`), and a file is found in whichever of them it went to.",
            "in": "header",
            "name": "Ocost-Business",
            "required": false,
            "schema": {
              "description": "The business this request acts in, by its id: one of your group's that the key reaches (403 `urn:ocost:key:business` otherwise). Without it, the business the key was made in; a file sent without it by a key that reaches several goes to the company its document names (`routed_by`), and a file is found in whichever of them it went to.",
              "title": "Ocost-Business",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicFile"
                }
              }
            },
            "description": "Successful Response"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              },
              "application/problem+json": {}
            },
            "description": "Bad Request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              },
              "application/problem+json": {}
            },
            "description": "Unauthorized"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              },
              "application/problem+json": {}
            },
            "description": "Forbidden"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              },
              "application/problem+json": {}
            },
            "description": "Not Found"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              },
              "application/problem+json": {}
            },
            "description": "Unprocessable Content"
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              },
              "application/problem+json": {}
            },
            "description": "Too Many Requests"
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              },
              "application/problem+json": {}
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "ApiKey": []
          }
        ],
        "summary": "Get File"
      },
      "patch": {
        "description": "Says which business a file waiting for its company (`needs_company`)\nbelongs to: one the key reaches (403 otherwise; `GET /businesses`). It is\nread on there, counted there, and found by its id as before; Ocost's\nquestion about it goes. The same bytes kept there already: that file is\nthe answer, and this one goes. 409 for a file that doesn't wait for its\ncompany.",
        "operationId": "assign_file",
        "parameters": [
          {
            "description": "The file's `id`, as `POST /files` answered it",
            "in": "path",
            "name": "file_id",
            "required": true,
            "schema": {
              "description": "The file's `id`, as `POST /files` answered it",
              "format": "uuid",
              "title": "File Id",
              "type": "string"
            }
          },
          {
            "description": "The business this request acts in, by its id: one of your group's that the key reaches (403 `urn:ocost:key:business` otherwise). Without it, the business the key was made in; a file sent without it by a key that reaches several goes to the company its document names (`routed_by`), and a file is found in whichever of them it went to.",
            "in": "header",
            "name": "Ocost-Business",
            "required": false,
            "schema": {
              "description": "The business this request acts in, by its id: one of your group's that the key reaches (403 `urn:ocost:key:business` otherwise). Without it, the business the key was made in; a file sent without it by a key that reaches several goes to the company its document names (`routed_by`), and a file is found in whichever of them it went to.",
              "title": "Ocost-Business",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/FileCompany"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicFile"
                }
              }
            },
            "description": "Successful Response"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              },
              "application/problem+json": {}
            },
            "description": "Bad Request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              },
              "application/problem+json": {}
            },
            "description": "Unauthorized"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              },
              "application/problem+json": {}
            },
            "description": "Forbidden"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              },
              "application/problem+json": {}
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              },
              "application/problem+json": {}
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              },
              "application/problem+json": {}
            },
            "description": "Unprocessable Content"
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              },
              "application/problem+json": {}
            },
            "description": "Too Many Requests"
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              },
              "application/problem+json": {}
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "ApiKey": []
          }
        ],
        "summary": "Assign File"
      }
    },
    "/files/{file_id}/content": {
      "get": {
        "description": "The original's bytes, as they were sent.",
        "operationId": "get_file_content",
        "parameters": [
          {
            "description": "The file's `id`, as `POST /files` answered it",
            "in": "path",
            "name": "file_id",
            "required": true,
            "schema": {
              "description": "The file's `id`, as `POST /files` answered it",
              "format": "uuid",
              "title": "File Id",
              "type": "string"
            }
          },
          {
            "description": "The business this request acts in, by its id: one of your group's that the key reaches (403 `urn:ocost:key:business` otherwise). Without it, the business the key was made in; a file sent without it by a key that reaches several goes to the company its document names (`routed_by`), and a file is found in whichever of them it went to.",
            "in": "header",
            "name": "Ocost-Business",
            "required": false,
            "schema": {
              "description": "The business this request acts in, by its id: one of your group's that the key reaches (403 `urn:ocost:key:business` otherwise). Without it, the business the key was made in; a file sent without it by a key that reaches several goes to the company its document names (`routed_by`), and a file is found in whichever of them it went to.",
              "title": "Ocost-Business",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/pdf": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "application/xml": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "image/*": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              }
            },
            "description": "Successful Response"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              },
              "application/problem+json": {}
            },
            "description": "Bad Request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              },
              "application/problem+json": {}
            },
            "description": "Unauthorized"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              },
              "application/problem+json": {}
            },
            "description": "Forbidden"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              },
              "application/problem+json": {}
            },
            "description": "Not Found"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              },
              "application/problem+json": {}
            },
            "description": "Unprocessable Content"
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              },
              "application/problem+json": {}
            },
            "description": "Too Many Requests"
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              },
              "application/problem+json": {}
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "ApiKey": []
          }
        ],
        "summary": "Get File Content"
      }
    },
    "/files/{file_id}/document": {
      "get": {
        "description": "The file's first document as `ocost.document.v1`: what a bill is\nfilled from. A file holding several lists them all (`documents`), each\nat `/documents/{id}`. 404 while it has none.",
        "operationId": "get_file_document",
        "parameters": [
          {
            "description": "The file's `id`, as `POST /files` answered it",
            "in": "path",
            "name": "file_id",
            "required": true,
            "schema": {
              "description": "The file's `id`, as `POST /files` answered it",
              "format": "uuid",
              "title": "File Id",
              "type": "string"
            }
          },
          {
            "description": "The business this request acts in, by its id: one of your group's that the key reaches (403 `urn:ocost:key:business` otherwise). Without it, the business the key was made in; a file sent without it by a key that reaches several goes to the company its document names (`routed_by`), and a file is found in whichever of them it went to.",
            "in": "header",
            "name": "Ocost-Business",
            "required": false,
            "schema": {
              "description": "The business this request acts in, by its id: one of your group's that the key reaches (403 `urn:ocost:key:business` otherwise). Without it, the business the key was made in; a file sent without it by a key that reaches several goes to the company its document names (`routed_by`), and a file is found in whichever of them it went to.",
              "title": "Ocost-Business",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Document"
                }
              }
            },
            "description": "Successful Response"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              },
              "application/problem+json": {}
            },
            "description": "Bad Request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              },
              "application/problem+json": {}
            },
            "description": "Unauthorized"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              },
              "application/problem+json": {}
            },
            "description": "Forbidden"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              },
              "application/problem+json": {}
            },
            "description": "Not Found"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              },
              "application/problem+json": {}
            },
            "description": "Unprocessable Content"
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              },
              "application/problem+json": {}
            },
            "description": "Too Many Requests"
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              },
              "application/problem+json": {}
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "ApiKey": []
          }
        ],
        "summary": "Get File Document"
      }
    },
    "/search": {
      "get": {
        "description": "Finds documents by what they say, in words and by meaning, best first:\none result per document (a file without one as itself), each with its\nbest passages and its card's facts that have the words, and links to\nthe file and the document. Filters: the kind, the issue and due dates,\na party by name or VAT ID, the gross, the direction, open or paid, an\nECLASS category. `match=exact` finds only documents holding the text as\nwritten. Only the key's business's files outside the Trash.\nWhile the index is building, the words still answer (`meaning:\nunavailable`).",
        "operationId": "search",
        "parameters": [
          {
            "description": "What to find: words, a number, or what it means",
            "in": "query",
            "name": "q",
            "required": true,
            "schema": {
              "description": "What to find: words, a number, or what it means",
              "examples": [
                "Bürostühle",
                "RE-2026-0412"
              ],
              "maxLength": 200,
              "minLength": 1,
              "title": "Q",
              "type": "string"
            }
          },
          {
            "description": "Only documents of these kinds; repeat it for several",
            "in": "query",
            "name": "kind",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "items": {
                    "$ref": "#/components/schemas/Kind"
                  },
                  "type": "array"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Only documents of these kinds; repeat it for several",
              "title": "Kind"
            }
          },
          {
            "description": "Issued on or after",
            "in": "query",
            "name": "since",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "format": "date",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Issued on or after",
              "title": "Since"
            }
          },
          {
            "description": "Issued on or before",
            "in": "query",
            "name": "until",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "format": "date",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Issued on or before",
              "title": "Until"
            }
          },
          {
            "description": "A party's name, as read: seller, buyer…",
            "in": "query",
            "name": "party",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 200,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "A party's name, as read: seller, buyer…",
              "title": "Party"
            }
          },
          {
            "description": "A party's VAT ID, as read",
            "in": "query",
            "name": "vat_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 32,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "A party's VAT ID, as read",
              "title": "Vat Id"
            }
          },
          {
            "description": "exact: every document holding `q` as written (case, accents and spacing aside), never one that only means the same; keywords: by its words; meaning: by what it means; hybrid: both",
            "in": "query",
            "name": "match",
            "required": false,
            "schema": {
              "default": "hybrid",
              "description": "exact: every document holding `q` as written (case, accents and spacing aside), never one that only means the same; keywords: by its words; meaning: by what it means; hybrid: both",
              "enum": [
                "exact",
                "keywords",
                "meaning",
                "hybrid"
              ],
              "title": "Match",
              "type": "string"
            }
          },
          {
            "description": "An invoice due on or after",
            "in": "query",
            "name": "due_since",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "format": "date",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "An invoice due on or after",
              "title": "Due Since"
            }
          },
          {
            "description": "An invoice due on or before",
            "in": "query",
            "name": "due_until",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "format": "date",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "An invoice due on or before",
              "title": "Due Until"
            }
          },
          {
            "description": "Gross at least, in the business's currency",
            "in": "query",
            "name": "gross_min",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "minimum": 0.0,
                  "type": "number"
                },
                {
                  "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Gross at least, in the business's currency",
              "title": "Gross Min"
            }
          },
          {
            "description": "Gross at most, in the business's currency",
            "in": "query",
            "name": "gross_max",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "minimum": 0.0,
                  "type": "number"
                },
                {
                  "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Gross at most, in the business's currency",
              "title": "Gross Max"
            }
          },
          {
            "description": "incoming: from suppliers; outgoing: to customers",
            "in": "query",
            "name": "direction",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "enum": [
                    "incoming",
                    "outgoing"
                  ],
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "incoming: from suppliers; outgoing: to customers",
              "title": "Direction"
            }
          },
          {
            "description": "An invoice's: open (unpaid) or paid",
            "in": "query",
            "name": "status",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "enum": [
                    "open",
                    "paid"
                  ],
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "An invoice's: open (unpaid) or paid",
              "title": "Status"
            }
          },
          {
            "description": "An ECLASS code of any level: documents with a line in it or under it",
            "in": "query",
            "name": "category",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "pattern": "^[1-9]\\d{7}$",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "An ECLASS code of any level: documents with a line in it or under it",
              "examples": [
                "24000000"
              ],
              "title": "Category"
            }
          },
          {
            "description": "Results per page",
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "default": 20,
              "description": "Results per page",
              "maximum": 50,
              "minimum": 1,
              "title": "Limit",
              "type": "integer"
            }
          },
          {
            "description": "Results to skip: the next page's start",
            "in": "query",
            "name": "offset",
            "required": false,
            "schema": {
              "default": 0,
              "description": "Results to skip: the next page's start",
              "maximum": 250,
              "minimum": 0,
              "title": "Offset",
              "type": "integer"
            }
          },
          {
            "description": "The business this request acts in, by its id: one of your group's that the key reaches (403 `urn:ocost:key:business` otherwise). Without it, the business the key was made in; a file sent without it by a key that reaches several goes to the company its document names (`routed_by`), and a file is found in whichever of them it went to.",
            "in": "header",
            "name": "Ocost-Business",
            "required": false,
            "schema": {
              "description": "The business this request acts in, by its id: one of your group's that the key reaches (403 `urn:ocost:key:business` otherwise). Without it, the business the key was made in; a file sent without it by a key that reaches several goes to the company its document names (`routed_by`), and a file is found in whichever of them it went to.",
              "title": "Ocost-Business",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SearchResults"
                }
              }
            },
            "description": "Successful Response"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              },
              "application/problem+json": {}
            },
            "description": "Bad Request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              },
              "application/problem+json": {}
            },
            "description": "Unauthorized"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              },
              "application/problem+json": {}
            },
            "description": "Forbidden"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              },
              "application/problem+json": {}
            },
            "description": "Not Found"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              },
              "application/problem+json": {}
            },
            "description": "Unprocessable Content"
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              },
              "application/problem+json": {}
            },
            "description": "Too Many Requests"
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              },
              "application/problem+json": {}
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "ApiKey": []
          }
        ],
        "summary": "Search"
      }
    }
  },
  "servers": [
    {
      "url": "https://api.ocost.io/public/v1"
    }
  ]
}
