{
  "components": {
    "schemas": {
      "Address": {
        "properties": {
          "city": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "BT-37, BT-52",
            "title": "City"
          },
          "country": {
            "anyOf": [
              {
                "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"
          }
        },
        "required": [
          "street",
          "postal_code",
          "city",
          "country"
        ],
        "title": "Address",
        "type": "object"
      },
      "Attention": {
        "description": "What a person should look at before booking 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": [
          "title",
          "summary",
          "facts"
        ],
        "title": "Card",
        "type": "object"
      },
      "Check": {
        "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",
            "items": {
              "type": "string"
            },
            "title": "Fields",
            "type": "array"
          },
          "name": {
            "description": "total, vat, vat_net, vat_tax, gross, payable, signs, skonto, deduction, deductions, quantity (the sums), dates, iban, vat_id, …",
            "title": "Name",
            "type": "string"
          },
          "passed": {
            "title": "Passed",
            "type": "boolean"
          },
          "sums": {
            "description": "One of the sums: fill a bill only when all pass",
            "title": "Sums",
            "type": "boolean"
          }
        },
        "required": [
          "name",
          "passed",
          "sums",
          "fields",
          "at"
        ],
        "title": "Check",
        "type": "object"
      },
      "Confidence": {
        "description": "How sure Ocost is of a value, from its checks: never a model's grade.",
        "enum": [
          "checked",
          "read",
          "doubt"
        ],
        "title": "Confidence",
        "type": "string"
      },
      "Contact": {
        "properties": {
          "email": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "BT-43, BT-58",
            "title": "Email"
          },
          "phone": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "BT-42, BT-57",
            "title": "Phone"
          }
        },
        "required": [
          "email",
          "phone"
        ],
        "title": "Contact",
        "type": "object"
      },
      "Deduction": {
        "description": "A final invoice's: an earlier invoice it takes off.",
        "properties": {
          "gross": {
            "anyOf": [
              {
                "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": [
              {
                "pattern": "^-?[0-9]+(\\.[0-9]+)?$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Net"
          },
          "number": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Number"
          },
          "tax": {
            "anyOf": [
              {
                "pattern": "^-?[0-9]+(\\.[0-9]+)?$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Tax"
          }
        },
        "required": [
          "number",
          "issue_date",
          "net",
          "tax",
          "gross"
        ],
        "title": "Deduction",
        "type": "object"
      },
      "Direction": {
        "enum": [
          "incoming",
          "outgoing",
          "unsure"
        ],
        "title": "Direction",
        "type": "string"
      },
      "Document": {
        "description": "ocost.document.v1: one document as Ocost read it.",
        "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": [
              {
                "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",
            "description": "incoming: to the business; outgoing: it issued it; unsure"
          },
          "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": {
            "format": "uuid",
            "title": "File Id",
            "type": "string"
          },
          "id": {
            "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": {
            "description": "The exact kind, for information",
            "title": "Kind Detail",
            "type": "string"
          },
          "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": {
            "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": {
            "enum": [
              "e_invoice",
              "reader"
            ],
            "title": "Read With",
            "type": "string"
          },
          "schema": {
            "const": "ocost.document.v1",
            "default": "ocost.document.v1",
            "title": "Schema",
            "type": "string"
          },
          "seller": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Party"
              },
              {
                "type": "null"
              }
            ],
            "description": "BG-4"
          },
          "sources": {
            "additionalProperties": {
              "$ref": "#/components/schemas/Source"
            },
            "description": "Per value, by its path (number, totals.gross, seller.vat_id)",
            "title": "Sources",
            "type": "object"
          },
          "tax_check": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/TaxCheck"
              },
              {
                "type": "null"
              }
            ]
          },
          "totals": {
            "$ref": "#/components/schemas/Totals"
          },
          "type_code": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "BT-3, UNCL 1001: 380, 381, 384, 326",
            "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",
          "type_code",
          "number",
          "issue_date",
          "due_date",
          "delivery_date",
          "invoicing_period_start",
          "invoicing_period_end",
          "valid_until",
          "currency",
          "buyer_reference",
          "order_reference",
          "order_references",
          "preceding_invoice",
          "seller",
          "buyer",
          "payee",
          "deliver_to",
          "other_parties",
          "payment",
          "early_payment_discounts",
          "totals",
          "vat_breakdown",
          "lines",
          "deductions",
          "card",
          "worked_out",
          "sources",
          "checks",
          "tax_check",
          "attention",
          "possible_duplicate_of",
          "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",
          "number",
          "pages"
        ],
        "title": "DocumentRef",
        "type": "object"
      },
      "EarlyPaymentDiscount": {
        "description": "Skonto: XRechnung's #SKONTO# in BT-20.",
        "properties": {
          "base_amount": {
            "anyOf": [
              {
                "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 %",
            "pattern": "^-?[0-9]+(\\.[0-9]+)?$",
            "title": "Percent",
            "type": "string"
          }
        },
        "required": [
          "days",
          "percent",
          "base_amount",
          "due_date"
        ],
        "title": "EarlyPaymentDiscount",
        "type": "object"
      },
      "Fact": {
        "properties": {
          "amount": {
            "anyOf": [
              {
                "pattern": "^-?[0-9]+(\\.[0-9]+)?$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Amount"
          },
          "currency": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Currency"
          },
          "date": {
            "anyOf": [
              {
                "format": "date",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Date"
          },
          "kind": {
            "title": "Kind",
            "type": "string"
          },
          "label": {
            "description": "What it is, in the document's words",
            "title": "Label",
            "type": "string"
          },
          "number": {
            "anyOf": [
              {
                "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",
          "date",
          "amount",
          "currency",
          "number",
          "text",
          "page"
        ],
        "title": "Fact",
        "type": "object"
      },
      "FieldError": {
        "description": "One invalid field of a request.",
        "properties": {
          "loc": {
            "items": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "integer"
                }
              ]
            },
            "title": "Loc",
            "type": "array"
          },
          "msg": {
            "title": "Msg",
            "type": "string"
          },
          "type": {
            "title": "Type",
            "type": "string"
          }
        },
        "required": [
          "loc",
          "msg",
          "type"
        ],
        "title": "FieldError",
        "type": "object"
      },
      "FileStatus": {
        "enum": [
          "received",
          "reading",
          "read",
          "not_read",
          "failed"
        ],
        "title": "FileStatus",
        "type": "string"
      },
      "FoundFact": {
        "properties": {
          "label": {
            "title": "Label",
            "type": "string"
          },
          "text": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Text"
          }
        },
        "required": [
          "label",
          "text"
        ],
        "title": "FoundFact",
        "type": "object"
      },
      "Hit": {
        "properties": {
          "found_by": {
            "enum": [
              "words",
              "meaning",
              "both"
            ],
            "title": "Found By",
            "type": "string"
          },
          "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\nexact kind is `kind_detail`.",
        "enum": [
          "invoice",
          "credit_note",
          "invoice_correction",
          "receipt",
          "pro_forma",
          "delivery_note",
          "order",
          "order_confirmation",
          "quote",
          "contract",
          "statement",
          "payment_reminder",
          "other"
        ],
        "title": "Kind",
        "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": [
              {
                "pattern": "^-?[0-9]+(\\.[0-9]+)?$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Still to come",
            "title": "Backordered Quantity"
          },
          "base_quantity": {
            "anyOf": [
              {
                "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"
              }
            ],
            "title": "Batch"
          },
          "discount_percent": {
            "anyOf": [
              {
                "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": [
              {
                "pattern": "^-?[0-9]+(\\.[0-9]+)?$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "BT-131",
            "title": "Net Amount"
          },
          "ordered_quantity": {
            "anyOf": [
              {
                "pattern": "^-?[0-9]+(\\.[0-9]+)?$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "A delivery note's",
            "title": "Ordered Quantity"
          },
          "price": {
            "anyOf": [
              {
                "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": [
              {
                "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": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "BT-130: UNECE Rec 20 (C62, HUR, KGM) or Rec 21 (XCT); null when none is printed",
            "title": "Unit"
          },
          "vat_category": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "BT-151",
            "title": "Vat Category"
          },
          "vat_rate": {
            "anyOf": [
              {
                "pattern": "^-?[0-9]+(\\.[0-9]+)?$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "BT-152, percent",
            "title": "Vat Rate"
          }
        },
        "required": [
          "id",
          "name",
          "seller_item_id",
          "standard_item_id",
          "quantity",
          "unit",
          "price",
          "base_quantity",
          "net_amount",
          "discount_percent",
          "vat_category",
          "vat_rate",
          "ordered_quantity",
          "backordered_quantity",
          "batch",
          "pzn",
          "attributes"
        ],
        "title": "Line",
        "type": "object"
      },
      "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": {
            "description": "What it is to the document: invoicee, payee, ship_to, carrier, factor, landlord, tenant, …",
            "title": "Role",
            "type": "string"
          },
          "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"
              }
            ],
            "title": "Website"
          }
        },
        "required": [
          "name",
          "vat_id",
          "tax_registration_id",
          "legal_registration_id",
          "address",
          "contact",
          "website",
          "role",
          "printed_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"
              }
            ],
            "title": "Website"
          }
        },
        "required": [
          "name",
          "vat_id",
          "tax_registration_id",
          "legal_registration_id",
          "address",
          "contact",
          "website"
        ],
        "title": "Party",
        "type": "object"
      },
      "Payment": {
        "description": "BG-16.",
        "properties": {
          "bic": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "BT-86",
            "title": "Bic"
          },
          "iban": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "BT-84",
            "title": "Iban"
          },
          "means": {
            "anyOf": [
              {
                "enum": [
                  "transfer",
                  "direct_debit",
                  "card",
                  "already_paid"
                ],
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The same, as a word",
            "title": "Means"
          },
          "means_code": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "BT-81, UNCL 4461: 58 SEPA credit transfer, 59 SEPA direct debit, 48 card; null when it doesn't say or it was paid already",
            "title": "Means Code"
          },
          "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"
          }
        },
        "required": [
          "means_code",
          "means",
          "iban",
          "bic",
          "terms",
          "net_days",
          "paid_on"
        ],
        "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.",
        "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",
            "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",
          "reason",
          "renews_on",
          "pages",
          "pages_read",
          "external_ref",
          "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",
          "next_cursor",
          "more"
        ],
        "title": "PublicFiles",
        "type": "object"
      },
      "Reason": {
        "description": "Why a file is `not_read` or `failed`.",
        "enum": [
          "limit",
          "model_off",
          "nothing_found",
          "too_large",
          "damaged",
          "unavailable",
          "failed",
          "other"
        ],
        "title": "Reason",
        "type": "string"
      },
      "SearchResult": {
        "properties": {
          "buyer": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "As read",
            "title": "Buyer"
          },
          "currency": {
            "anyOf": [
              {
                "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": [
              {
                "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",
          "document_id",
          "kind",
          "number",
          "seller",
          "buyer",
          "issue_date",
          "gross",
          "currency",
          "pages",
          "passages",
          "facts",
          "file_url",
          "document_url"
        ],
        "title": "SearchResult",
        "type": "object"
      },
      "SearchResults": {
        "properties": {
          "meaning": {
            "description": "unavailable: the index is building or its model unreachable; the words still answer",
            "enum": [
              "available",
              "unavailable"
            ],
            "title": "Meaning",
            "type": "string"
          },
          "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": {
        "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 check that failed",
            "title": "Why"
          }
        },
        "required": [
          "page",
          "quote",
          "confidence",
          "why"
        ],
        "title": "Source",
        "type": "object"
      },
      "TaxCheck": {
        "description": "An incoming invoice's § 14 UStG check (Germany's rules).",
        "properties": {
          "case": {
            "description": "standard, small, reverse_charge, intra_eu, exempt",
            "title": "Case",
            "type": "string"
          },
          "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": {
            "title": "Item",
            "type": "string"
          },
          "law": {
            "description": "The paragraph that asks for it",
            "title": "Law",
            "type": "string"
          }
        },
        "required": [
          "item",
          "law",
          "at_stake"
        ],
        "title": "TaxItem",
        "type": "object"
      },
      "Totals": {
        "description": "BG-22.",
        "properties": {
          "gross": {
            "anyOf": [
              {
                "pattern": "^-?[0-9]+(\\.[0-9]+)?$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "BT-112",
            "title": "Gross"
          },
          "net": {
            "anyOf": [
              {
                "pattern": "^-?[0-9]+(\\.[0-9]+)?$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "BT-109",
            "title": "Net"
          },
          "payable": {
            "anyOf": [
              {
                "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": [
              {
                "pattern": "^-?[0-9]+(\\.[0-9]+)?$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "BT-110",
            "title": "Tax"
          }
        },
        "required": [
          "net",
          "tax",
          "gross",
          "payable",
          "prices_include_vat"
        ],
        "title": "Totals",
        "type": "object"
      },
      "VatGroup": {
        "description": "BG-23.",
        "properties": {
          "category": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "BT-118, UNCL 5305: S, Z, E, AE, K, G, O",
            "title": "Category"
          },
          "exemption_reason": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "BT-120",
            "title": "Exemption Reason"
          },
          "rate": {
            "anyOf": [
              {
                "pattern": "^-?[0-9]+(\\.[0-9]+)?$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "BT-119, percent: 19",
            "title": "Rate"
          },
          "tax_amount": {
            "description": "BT-117",
            "pattern": "^-?[0-9]+(\\.[0-9]+)?$",
            "title": "Tax Amount",
            "type": "string"
          },
          "taxable_amount": {
            "description": "BT-116",
            "pattern": "^-?[0-9]+(\\.[0-9]+)?$",
            "title": "Taxable Amount",
            "type": "string"
          }
        },
        "required": [
          "category",
          "rate",
          "taxable_amount",
          "tax_amount",
          "exemption_reason"
        ],
        "title": "VatGroup",
        "type": "object"
      },
      "WorkedOut": {
        "description": "An amount Ocost worked out because the one read can't be it.",
        "properties": {
          "field": {
            "description": "Its path in this document",
            "title": "Field",
            "type": "string"
          },
          "printed": {
            "anyOf": [
              {
                "pattern": "^-?[0-9]+(\\.[0-9]+)?$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "What was read",
            "title": "Printed"
          },
          "rule": {
            "title": "Rule",
            "type": "string"
          }
        },
        "required": [
          "field",
          "printed",
          "rule"
        ],
        "title": "WorkedOut",
        "type": "object"
      }
    },
    "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://app.ocost.io/developers\n\nFor AI assistants and tools: https://app.ocost.io/llms.txt lists every guide\nas Markdown, https://app.ocost.io/llms-full.txt holds them all in one file,\nand this document is at https://app.ocost.io/developers/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"
    }
  ]
}
