{
  "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"
      },
      "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- `iban`: The IBAN's check digits hold\n- `vat_id`: A German VAT ID's check digit holds\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",
          "iban",
          "vat_id",
          "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": "A decimal as a string, never a number",
                "examples": [
                  "1270.92"
                ],
                "pattern": "^-?[0-9]+(\\.[0-9]+)?$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Gross"
          },
          "issue_date": {
            "anyOf": [
              {
                "format": "date",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Issue Date"
          },
          "net": {
            "anyOf": [
              {
                "description": "A decimal as a string, never a number",
                "examples": [
                  "1270.92"
                ],
                "pattern": "^-?[0-9]+(\\.[0-9]+)?$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Net"
          },
          "number": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Number"
          },
          "tax": {
            "anyOf": [
              {
                "description": "A decimal as a string, never a number",
                "examples": [
                  "1270.92"
                ],
                "pattern": "^-?[0-9]+(\\.[0-9]+)?$",
                "type": "string"
              },
              {
                "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.00",
                "price": "189.00",
                "quantity": "4",
                "seller_item_id": "ES-200",
                "unit": "H87",
                "vat_category": "S",
                "vat_rate": "19"
              },
              {
                "attributes": {},
                "id": "2",
                "name": "Montage",
                "net_amount": "312.00",
                "price": "78.00",
                "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": {
                "confidence": "checked",
                "page": 1,
                "quote": "1.270,92 €"
              }
            },
            "tax_check": {
              "case": "standard",
              "missing": []
            },
            "totals": {
              "gross": "1270.92",
              "net": "1068.00",
              "prices_include_vat": false,
              "tax": "202.92"
            },
            "type_code": "380",
            "vat_breakdown": [
              {
                "category": "S",
                "rate": "19",
                "tax_amount": "202.92",
                "taxable_amount": "1068.00"
              }
            ],
            "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"
          },
          "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",
            "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"
              }
            ]
          },
          "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": "A decimal as a string, never a number",
                "examples": [
                  "1270.92"
                ],
                "pattern": "^-?[0-9]+(\\.[0-9]+)?$",
                "type": "string"
              },
              {
                "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"
            ],
            "pattern": "^-?[0-9]+(\\.[0-9]+)?$",
            "title": "Percent",
            "type": "string"
          }
        },
        "required": [
          "days",
          "percent"
        ],
        "title": "EarlyPaymentDiscount",
        "type": "object"
      },
      "Fact": {
        "properties": {
          "amount": {
            "anyOf": [
              {
                "description": "A decimal as a string, never a number",
                "examples": [
                  "1270.92"
                ],
                "pattern": "^-?[0-9]+(\\.[0-9]+)?$",
                "type": "string"
              },
              {
                "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": "A decimal as a string, never a number",
                "examples": [
                  "1270.92"
                ],
                "pattern": "^-?[0-9]+(\\.[0-9]+)?$",
                "type": "string"
              },
              {
                "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"
      },
      "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"
      },
      "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",
        "enum": [
          "received",
          "reading",
          "read",
          "not_read",
          "failed"
        ],
        "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"
      },
      "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- `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",
          "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"
        ],
        "title": "KindDetail",
        "type": "string"
      },
      "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": "A decimal as a string, never a number",
                "examples": [
                  "1270.92"
                ],
                "pattern": "^-?[0-9]+(\\.[0-9]+)?$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Still to come",
            "title": "Backordered Quantity"
          },
          "base_quantity": {
            "anyOf": [
              {
                "description": "A decimal as a string, never a number",
                "examples": [
                  "1270.92"
                ],
                "pattern": "^-?[0-9]+(\\.[0-9]+)?$",
                "type": "string"
              },
              {
                "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": "A decimal as a string, never a number",
                "examples": [
                  "1270.92"
                ],
                "pattern": "^-?[0-9]+(\\.[0-9]+)?$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The line's discount: 5",
            "title": "Discount Percent"
          },
          "id": {
            "description": "BT-126: its position",
            "title": "Id",
            "type": "string"
          },
          "name": {
            "description": "BT-153",
            "title": "Name",
            "type": "string"
          },
          "net_amount": {
            "anyOf": [
              {
                "description": "A decimal as a string, never a number",
                "examples": [
                  "1270.92"
                ],
                "pattern": "^-?[0-9]+(\\.[0-9]+)?$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "BT-131",
            "title": "Net Amount"
          },
          "ordered_quantity": {
            "anyOf": [
              {
                "description": "A decimal as a string, never a number",
                "examples": [
                  "1270.92"
                ],
                "pattern": "^-?[0-9]+(\\.[0-9]+)?$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "A delivery note's",
            "title": "Ordered Quantity"
          },
          "price": {
            "anyOf": [
              {
                "description": "A decimal as a string, never a number",
                "examples": [
                  "1270.92"
                ],
                "pattern": "^-?[0-9]+(\\.[0-9]+)?$",
                "type": "string"
              },
              {
                "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": "A decimal as a string, never a number",
                "examples": [
                  "1270.92"
                ],
                "pattern": "^-?[0-9]+(\\.[0-9]+)?$",
                "type": "string"
              },
              {
                "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"
          },
          "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": "A decimal as a string, never a number",
                "examples": [
                  "1270.92"
                ],
                "pattern": "^-?[0-9]+(\\.[0-9]+)?$",
                "type": "string"
              },
              {
                "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"
          },
          "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"
          },
          "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"
      },
      "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": {
          "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"
          },
          "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": {
          "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",
            "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"
      },
      "PublicFile": {
        "description": "A file sent, and how far Ocost is with it.",
        "examples": [
          {
            "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",
            "id": "01a1b08c-6e3a-7562-8f4a-7924722667b1",
            "name": "RE-2026-1187.pdf",
            "pages": 1,
            "sha256": "9f2c000000000000000000000000000000000000000000000000000000000000",
            "size_bytes": 48211,
            "status": "read",
            "updated_at": "2026-11-03T09:13:05Z"
          }
        ],
        "properties": {
          "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 sent",
            "title": "External Ref"
          },
          "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"
          },
          "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",
          "documents",
          "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"
      },
      "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": "A decimal as a string, never a number",
                "examples": [
                  "1270.92"
                ],
                "pattern": "^-?[0-9]+(\\.[0-9]+)?$",
                "type": "string"
              },
              {
                "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": {
          "confidence": {
            "$ref": "#/components/schemas/Confidence"
          },
          "page": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "description": "Where it was read, 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",
        "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"
        ],
        "title": "TaxItemKind",
        "type": "string"
      },
      "Totals": {
        "description": "BG-22.",
        "properties": {
          "gross": {
            "anyOf": [
              {
                "description": "A decimal as a string, never a number",
                "examples": [
                  "1270.92"
                ],
                "pattern": "^-?[0-9]+(\\.[0-9]+)?$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "BT-112",
            "title": "Gross"
          },
          "net": {
            "anyOf": [
              {
                "description": "A decimal as a string, never a number",
                "examples": [
                  "1270.92"
                ],
                "pattern": "^-?[0-9]+(\\.[0-9]+)?$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "BT-109",
            "title": "Net"
          },
          "payable": {
            "anyOf": [
              {
                "description": "A decimal as a string, never a number",
                "examples": [
                  "1270.92"
                ],
                "pattern": "^-?[0-9]+(\\.[0-9]+)?$",
                "type": "string"
              },
              {
                "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": "A decimal as a string, never a number",
                "examples": [
                  "1270.92"
                ],
                "pattern": "^-?[0-9]+(\\.[0-9]+)?$",
                "type": "string"
              },
              {
                "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": "A decimal as a string, never a number",
                "examples": [
                  "1270.92"
                ],
                "pattern": "^-?[0-9]+(\\.[0-9]+)?$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "BT-119, percent: 19",
            "title": "Rate"
          },
          "tax_amount": {
            "description": "BT-117",
            "examples": [
              "1270.92"
            ],
            "pattern": "^-?[0-9]+(\\.[0-9]+)?$",
            "title": "Tax Amount",
            "type": "string"
          },
          "taxable_amount": {
            "description": "BT-116",
            "examples": [
              "1270.92"
            ],
            "pattern": "^-?[0-9]+(\\.[0-9]+)?$",
            "title": "Taxable Amount",
            "type": "string"
          }
        },
        "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": "A decimal as a string, never a number",
                "examples": [
                  "1270.92"
                ],
                "pattern": "^-?[0-9]+(\\.[0-9]+)?$",
                "type": "string"
              },
              {
                "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",
        "enum": [
          "groups",
          "net_tax",
          "skonto",
          "payable",
          "outside"
        ],
        "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://docs.ocost.io\n\nFor AI assistants and tools: https://docs.ocost.io/llms.txt lists every guide\nas Markdown, https://docs.ocost.io/llms-full.txt holds them all in one file,\nand this document is at https://docs.ocost.io/openapi.json.",
    "title": "Ocost API",
    "version": "1"
  },
  "openapi": "3.1.0",
  "paths": {
    "/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"
            }
          }
        ],
        "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: what a connector polls. The next page is\n`next_cursor`'s; with no more, keep the last cursor and ask with it\nlater for what changed since. A change made as a page is read comes\non a later one.",
        "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": "`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"
            }
          }
        ],
        "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; the first\n`external_ref` stays). Each 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).",
        "operationId": "send_file",
        "requestBody": {
          "content": {
            "multipart/form-data": {
              "schema": {
                "properties": {
                  "external_ref": {
                    "description": "Your own id for it (an Odoo bill's), kept and given back",
                    "maxLength": 200,
                    "type": "string"
                  },
                  "file": {
                    "description": "A PDF, an image (JPEG, PNG, TIFF, WebP) 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"
            }
          }
        ],
        "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.",
        "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"
            }
          }
        ],
        "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"
      }
    },
    "/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"
            }
          }
        ],
        "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"
            }
          }
        ],
        "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"
            }
          }
        ],
        "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"
    }
  ]
}
