{
  "openapi": "3.1.0",
  "info": {
    "title": "אלופים בחשבוניות — public API v1 (Aluffim Invoices)",
    "version": "0.7.57",
    "description": "The routes an API key of a business may call, exactly as a key gets them. Every path names `{businessId}`: the business’s id, shown as \"מזהה העסק\" on the web app’s screen \"חיבור מערכות (API)\" and under a new key.\n\nA key belongs to one business and acts within its scopes and the current role of the owner or partner who created it. It is a server credential: a request that a browser sends (with `Origin` or `Sec-Fetch-Site`) is refused.\n\nEvery answer is the envelope `{ ok: true, data, requestId }` or `{ ok: false, error }`; programs branch on `error.code` and `error.details[].code` (a key's refusals: x-api-key-refusals) — `error.message` is a Hebrew text for people. A request body is JSON (`Content-Type: application/json`) of at most 1 MiB. An operation marked so needs an `Idempotency-Key` (a UUID): the same key with the same request replays the stored answer. Lists are pages of `items` with `nextCursor` (`null` on the last page). Answers may gain fields, and lists of values (enums) may gain values: a client ignores what it does not know.\n\nNothing from the Tax Authority beyond the numbers printed on a document reaches a key (marked x-tax-authority-data). Issuing documents (x-issuing) makes real, final documents of the business: there is no test environment; build with drafts and the draft's computation, and retry an issue with the same draft and the same Idempotency-Key."
  },
  "servers": [
    {
      "url": "https://invoice.aluffim.co.il/api"
    }
  ],
  "security": [
    {
      "apiKey": []
    }
  ],
  "tags": [
    {
      "name": "businesses",
      "description": "The business: its profile, settings and tax profile."
    },
    {
      "name": "customers",
      "description": "Customers: list, read, create, update, archive; preferences for new documents."
    },
    {
      "name": "items",
      "description": "Catalogue items: list, read, create, update, archive."
    },
    {
      "name": "documents",
      "description": "Documents: list and search, read, PDF copies, exchange rates; with the issuing capability also drafts, computation, derivation and the issue."
    },
    {
      "name": "delivery",
      "description": "Sending (open only where sending by key is): an issued document by e-mail to the addresses it names, with the sending option."
    },
    {
      "name": "expenses",
      "description": "Expenses (read only), their files, categories and filed VAT reports."
    },
    {
      "name": "archive",
      "description": "Imported documents (read only)."
    },
    {
      "name": "reports",
      "description": "Reports and report exports."
    },
    {
      "name": "collections",
      "description": "Payment status and balances (read only)."
    }
  ],
  "paths": {
    "/v1/businesses/{businessId}": {
      "get": {
        "operationId": "businesses.get",
        "tags": [
          "businesses"
        ],
        "summary": "The business: its profile, settings and tax profile.",
        "description": "API key with the scope `business.read` (the creator's current role must hold it too). A key's answer is `PublicApiBusiness`, narrower than the app's: what it does not hold never reaches a key.",
        "security": [
          {
            "apiKey": [
              "business.read"
            ]
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/PublicApiBusiness"
                    },
                    "requestId": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "ok",
                    "data",
                    "requestId"
                  ]
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error400"
          },
          "401": {
            "$ref": "#/components/responses/Error401"
          },
          "403": {
            "$ref": "#/components/responses/Error403"
          },
          "404": {
            "$ref": "#/components/responses/Error404"
          },
          "405": {
            "$ref": "#/components/responses/Error405"
          },
          "429": {
            "$ref": "#/components/responses/Error429"
          },
          "500": {
            "$ref": "#/components/responses/Error500"
          },
          "501": {
            "$ref": "#/components/responses/Error501"
          },
          "503": {
            "$ref": "#/components/responses/Error503"
          }
        },
        "x-scope": "business.read",
        "x-rate-class": "read",
        "x-error-codes": {
          "400": [
            "VALIDATION_FAILED"
          ],
          "401": [
            "UNAUTHENTICATED"
          ],
          "403": [
            "FORBIDDEN",
            "ACCESS_EXPIRED"
          ],
          "404": [
            "NOT_FOUND"
          ],
          "405": [
            "METHOD_NOT_ALLOWED"
          ],
          "429": [
            "RATE_LIMITED"
          ],
          "500": [
            "INTERNAL"
          ],
          "501": [
            "NOT_IMPLEMENTED"
          ],
          "503": [
            "SERVICE_UNAVAILABLE"
          ]
        },
        "x-narrowed": [
          "response"
        ]
      }
    },
    "/v1/businesses/{businessId}/archive/documents": {
      "get": {
        "operationId": "archive.list",
        "tags": [
          "archive"
        ],
        "summary": "Imported documents (read only, marked \"מיובא\").",
        "description": "API key with the scope `documents.read` (the creator's current role must hold it too).",
        "security": [
          {
            "apiKey": [
              "documents.read"
            ]
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "openFormatCode",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/OpenFormatDocCode"
            }
          },
          {
            "name": "from",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/LocalDate"
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/LocalDate"
            }
          },
          {
            "name": "importId",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 100
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 512
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "default": 25,
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "const": true
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "items": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/ArchivedDocumentSummary"
                          }
                        },
                        "nextCursor": {
                          "anyOf": [
                            {
                              "type": "string",
                              "maxLength": 512
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      },
                      "required": [
                        "items",
                        "nextCursor"
                      ]
                    },
                    "requestId": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "ok",
                    "data",
                    "requestId"
                  ]
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error400"
          },
          "401": {
            "$ref": "#/components/responses/Error401"
          },
          "403": {
            "$ref": "#/components/responses/Error403"
          },
          "404": {
            "$ref": "#/components/responses/Error404"
          },
          "405": {
            "$ref": "#/components/responses/Error405"
          },
          "429": {
            "$ref": "#/components/responses/Error429"
          },
          "500": {
            "$ref": "#/components/responses/Error500"
          },
          "501": {
            "$ref": "#/components/responses/Error501"
          },
          "503": {
            "$ref": "#/components/responses/Error503"
          }
        },
        "x-scope": "documents.read",
        "x-rate-class": "read",
        "x-error-codes": {
          "400": [
            "VALIDATION_FAILED"
          ],
          "401": [
            "UNAUTHENTICATED"
          ],
          "403": [
            "FORBIDDEN",
            "ACCESS_EXPIRED"
          ],
          "404": [
            "NOT_FOUND"
          ],
          "405": [
            "METHOD_NOT_ALLOWED"
          ],
          "429": [
            "RATE_LIMITED"
          ],
          "500": [
            "INTERNAL"
          ],
          "501": [
            "NOT_IMPLEMENTED"
          ],
          "503": [
            "SERVICE_UNAVAILABLE"
          ]
        }
      }
    },
    "/v1/businesses/{businessId}/archive/documents/{archivedDocumentId}": {
      "get": {
        "operationId": "archive.get",
        "tags": [
          "archive"
        ],
        "summary": "One imported document. Imported documents are never sent, cancelled or issued from here.",
        "description": "API key with the scope `documents.read` (the creator's current role must hold it too).",
        "security": [
          {
            "apiKey": [
              "documents.read"
            ]
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "archivedDocumentId",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/ArchivedDocument"
                    },
                    "requestId": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "ok",
                    "data",
                    "requestId"
                  ]
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error400"
          },
          "401": {
            "$ref": "#/components/responses/Error401"
          },
          "403": {
            "$ref": "#/components/responses/Error403"
          },
          "404": {
            "$ref": "#/components/responses/Error404"
          },
          "405": {
            "$ref": "#/components/responses/Error405"
          },
          "429": {
            "$ref": "#/components/responses/Error429"
          },
          "500": {
            "$ref": "#/components/responses/Error500"
          },
          "501": {
            "$ref": "#/components/responses/Error501"
          },
          "503": {
            "$ref": "#/components/responses/Error503"
          }
        },
        "x-scope": "documents.read",
        "x-rate-class": "read",
        "x-error-codes": {
          "400": [
            "VALIDATION_FAILED"
          ],
          "401": [
            "UNAUTHENTICATED"
          ],
          "403": [
            "FORBIDDEN",
            "ACCESS_EXPIRED"
          ],
          "404": [
            "NOT_FOUND"
          ],
          "405": [
            "METHOD_NOT_ALLOWED"
          ],
          "429": [
            "RATE_LIMITED"
          ],
          "500": [
            "INTERNAL"
          ],
          "501": [
            "NOT_IMPLEMENTED"
          ],
          "503": [
            "SERVICE_UNAVAILABLE"
          ]
        }
      }
    },
    "/v1/businesses/{businessId}/archive/documents/{archivedDocumentId}/download": {
      "post": {
        "operationId": "archive.downloadOriginal",
        "tags": [
          "archive"
        ],
        "summary": "A short-lived link to the original file of an imported document, as it was uploaded.",
        "description": "API key with the scope `documents.read` (the creator's current role must hold it too). Needs an `Idempotency-Key`, so it counts among the 60 requests with an `Idempotency-Key` a key may make in a minute.",
        "security": [
          {
            "apiKey": [
              "documents.read"
            ]
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "archivedDocumentId",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/DownloadLink"
                    },
                    "requestId": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "ok",
                    "data",
                    "requestId"
                  ]
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error400"
          },
          "401": {
            "$ref": "#/components/responses/Error401"
          },
          "403": {
            "$ref": "#/components/responses/Error403"
          },
          "404": {
            "$ref": "#/components/responses/Error404"
          },
          "405": {
            "$ref": "#/components/responses/Error405"
          },
          "409": {
            "$ref": "#/components/responses/Error409"
          },
          "422": {
            "$ref": "#/components/responses/Error422"
          },
          "429": {
            "$ref": "#/components/responses/Error429"
          },
          "500": {
            "$ref": "#/components/responses/Error500"
          },
          "501": {
            "$ref": "#/components/responses/Error501"
          },
          "503": {
            "$ref": "#/components/responses/Error503"
          }
        },
        "x-scope": "documents.read",
        "x-rate-class": "write",
        "x-error-codes": {
          "400": [
            "VALIDATION_FAILED",
            "IDEMPOTENCY_KEY_REQUIRED"
          ],
          "401": [
            "UNAUTHENTICATED"
          ],
          "403": [
            "FORBIDDEN",
            "ACCESS_EXPIRED"
          ],
          "404": [
            "NOT_FOUND"
          ],
          "405": [
            "METHOD_NOT_ALLOWED"
          ],
          "409": [
            "IDEMPOTENCY_REQUEST_IN_PROGRESS"
          ],
          "422": [
            "IDEMPOTENCY_KEY_REUSED"
          ],
          "429": [
            "RATE_LIMITED"
          ],
          "500": [
            "INTERNAL"
          ],
          "501": [
            "NOT_IMPLEMENTED"
          ],
          "503": [
            "SERVICE_UNAVAILABLE"
          ]
        }
      }
    },
    "/v1/businesses/{businessId}/collections": {
      "get": {
        "operationId": "collections.overview",
        "tags": [
          "collections"
        ],
        "summary": "Balances per customer and the open documents, overdue first.",
        "description": "API key with the scope `documents.read` (the creator's current role must hold it too).",
        "security": [
          {
            "apiKey": [
              "documents.read"
            ]
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "asOf",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/LocalDate"
            }
          },
          {
            "name": "filter",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "open",
                "overdue",
                "closed_by_hand",
                "paid",
                "all"
              ]
            }
          },
          {
            "name": "customerId",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "type",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "tax_invoice",
                "payment_demand",
                "quote",
                "order",
                "delivery_note"
              ]
            }
          },
          {
            "name": "from",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/LocalDate"
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/LocalDate"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "const": true
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "asOf": {
                          "$ref": "#/components/schemas/LocalDate"
                        },
                        "totals": {
                          "type": "object",
                          "properties": {
                            "balance": {
                              "$ref": "#/components/schemas/SignedAgorot"
                            },
                            "open": {
                              "$ref": "#/components/schemas/Agorot"
                            },
                            "overdue": {
                              "$ref": "#/components/schemas/Agorot"
                            },
                            "openDocuments": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "overdueDocuments": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "dueSoonDocuments": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "closedByHand": {
                              "$ref": "#/components/schemas/Agorot"
                            },
                            "previousSoftware": {
                              "$ref": "#/components/schemas/SignedAgorot"
                            }
                          },
                          "required": [
                            "balance",
                            "open",
                            "overdue",
                            "openDocuments",
                            "overdueDocuments",
                            "dueSoonDocuments",
                            "closedByHand"
                          ]
                        },
                        "customers": {
                          "maxItems": 5000,
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "customerId": {
                                "anyOf": [
                                  {
                                    "$ref": "#/components/schemas/Id"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "customerName": {
                                "type": "string",
                                "maxLength": 120
                              },
                              "balance": {
                                "$ref": "#/components/schemas/SignedAgorot"
                              },
                              "open": {
                                "$ref": "#/components/schemas/Agorot"
                              },
                              "overdue": {
                                "$ref": "#/components/schemas/Agorot"
                              },
                              "openDocuments": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              },
                              "overdueDocuments": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              },
                              "oldestOpenDate": {
                                "anyOf": [
                                  {
                                    "$ref": "#/components/schemas/LocalDate"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "nextDueDate": {
                                "anyOf": [
                                  {
                                    "$ref": "#/components/schemas/LocalDate"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "hasEmail": {
                                "type": "boolean"
                              },
                              "previousSoftware": {
                                "type": "object",
                                "properties": {
                                  "amount": {
                                    "$ref": "#/components/schemas/SignedAgorot"
                                  },
                                  "remaining": {
                                    "$ref": "#/components/schemas/SignedAgorot"
                                  },
                                  "asOf": {
                                    "$ref": "#/components/schemas/LocalDate"
                                  }
                                },
                                "required": [
                                  "amount",
                                  "remaining",
                                  "asOf"
                                ]
                              }
                            },
                            "required": [
                              "customerId",
                              "customerName",
                              "balance",
                              "open",
                              "overdue",
                              "openDocuments",
                              "overdueDocuments",
                              "oldestOpenDate",
                              "nextDueDate",
                              "hasEmail"
                            ]
                          }
                        },
                        "documents": {
                          "maxItems": 10000,
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "documentId": {
                                "$ref": "#/components/schemas/Id"
                              },
                              "type": {
                                "$ref": "#/components/schemas/DocumentType"
                              },
                              "variant": {
                                "$ref": "#/components/schemas/DocumentVariant"
                              },
                              "titleVariant": {
                                "anyOf": [
                                  {
                                    "$ref": "#/components/schemas/PaymentDemandTitle"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "number": {
                                "$ref": "#/components/schemas/DocumentNumber"
                              },
                              "documentDate": {
                                "$ref": "#/components/schemas/LocalDate"
                              },
                              "dueDate": {
                                "anyOf": [
                                  {
                                    "$ref": "#/components/schemas/LocalDate"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "customerId": {
                                "anyOf": [
                                  {
                                    "$ref": "#/components/schemas/Id"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "customerName": {
                                "type": "string",
                                "maxLength": 120
                              },
                              "currency": {
                                "$ref": "#/components/schemas/CurrencyCode"
                              },
                              "gross": {
                                "$ref": "#/components/schemas/Agorot"
                              },
                              "credited": {
                                "$ref": "#/components/schemas/Agorot"
                              },
                              "paid": {
                                "$ref": "#/components/schemas/Agorot"
                              },
                              "open": {
                                "$ref": "#/components/schemas/Agorot"
                              },
                              "status": {
                                "type": "string",
                                "enum": [
                                  "open",
                                  "partly_paid",
                                  "paid",
                                  "credited",
                                  "followed_up",
                                  "closed_by_hand",
                                  "cancelled"
                                ]
                              },
                              "overdue": {
                                "type": "boolean"
                              },
                              "daysOverdue": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              },
                              "closedByHand": {
                                "anyOf": [
                                  {
                                    "type": "object",
                                    "properties": {
                                      "reason": {
                                        "type": "string",
                                        "enum": [
                                          "customer_will_not_pay",
                                          "settled_otherwise",
                                          "other"
                                        ]
                                      },
                                      "note": {
                                        "anyOf": [
                                          {
                                            "type": "string",
                                            "maxLength": 200
                                          },
                                          {
                                            "type": "null"
                                          }
                                        ]
                                      },
                                      "closedAt": {
                                        "$ref": "#/components/schemas/Timestamp"
                                      },
                                      "closedByName": {
                                        "anyOf": [
                                          {
                                            "type": "string",
                                            "maxLength": 120
                                          },
                                          {
                                            "type": "null"
                                          }
                                        ]
                                      }
                                    },
                                    "required": [
                                      "reason",
                                      "note",
                                      "closedAt",
                                      "closedByName"
                                    ]
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "nextReminderOn": {
                                "anyOf": [
                                  {
                                    "$ref": "#/components/schemas/LocalDate"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              }
                            },
                            "required": [
                              "documentId",
                              "type",
                              "variant",
                              "titleVariant",
                              "number",
                              "documentDate",
                              "dueDate",
                              "customerId",
                              "customerName",
                              "currency",
                              "gross",
                              "credited",
                              "paid",
                              "open",
                              "status",
                              "overdue",
                              "daysOverdue",
                              "closedByHand",
                              "nextReminderOn"
                            ]
                          }
                        }
                      },
                      "required": [
                        "asOf",
                        "totals",
                        "customers",
                        "documents"
                      ]
                    },
                    "requestId": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "ok",
                    "data",
                    "requestId"
                  ]
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error400"
          },
          "401": {
            "$ref": "#/components/responses/Error401"
          },
          "403": {
            "$ref": "#/components/responses/Error403"
          },
          "404": {
            "$ref": "#/components/responses/Error404"
          },
          "405": {
            "$ref": "#/components/responses/Error405"
          },
          "429": {
            "$ref": "#/components/responses/Error429"
          },
          "500": {
            "$ref": "#/components/responses/Error500"
          },
          "501": {
            "$ref": "#/components/responses/Error501"
          },
          "503": {
            "$ref": "#/components/responses/Error503"
          }
        },
        "x-scope": "documents.read",
        "x-rate-class": "read",
        "x-error-codes": {
          "400": [
            "VALIDATION_FAILED"
          ],
          "401": [
            "UNAUTHENTICATED"
          ],
          "403": [
            "FORBIDDEN",
            "ACCESS_EXPIRED"
          ],
          "404": [
            "NOT_FOUND"
          ],
          "405": [
            "METHOD_NOT_ALLOWED"
          ],
          "429": [
            "RATE_LIMITED"
          ],
          "500": [
            "INTERNAL"
          ],
          "501": [
            "NOT_IMPLEMENTED"
          ],
          "503": [
            "SERVICE_UNAVAILABLE"
          ]
        }
      }
    },
    "/v1/businesses/{businessId}/collections/statuses": {
      "get": {
        "operationId": "collections.listStatuses",
        "tags": [
          "collections"
        ],
        "summary": "The payment status of up to 100 documents.",
        "description": "API key with the scope `documents.read` (the creator's current role must hold it too).",
        "security": [
          {
            "apiKey": [
              "documents.read"
            ]
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "ids",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}(?:,[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}){0,99}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "const": true
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "asOf": {
                          "$ref": "#/components/schemas/LocalDate"
                        },
                        "statuses": {
                          "maxItems": 100,
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "documentId": {
                                "$ref": "#/components/schemas/Id"
                              },
                              "status": {
                                "type": "string",
                                "enum": [
                                  "open",
                                  "partly_paid",
                                  "paid",
                                  "credited",
                                  "followed_up",
                                  "closed_by_hand",
                                  "cancelled"
                                ]
                              },
                              "overdue": {
                                "type": "boolean"
                              },
                              "open": {
                                "$ref": "#/components/schemas/Agorot"
                              }
                            },
                            "required": [
                              "documentId",
                              "status",
                              "overdue",
                              "open"
                            ]
                          }
                        }
                      },
                      "required": [
                        "asOf",
                        "statuses"
                      ]
                    },
                    "requestId": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "ok",
                    "data",
                    "requestId"
                  ]
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error400"
          },
          "401": {
            "$ref": "#/components/responses/Error401"
          },
          "403": {
            "$ref": "#/components/responses/Error403"
          },
          "404": {
            "$ref": "#/components/responses/Error404"
          },
          "405": {
            "$ref": "#/components/responses/Error405"
          },
          "429": {
            "$ref": "#/components/responses/Error429"
          },
          "500": {
            "$ref": "#/components/responses/Error500"
          },
          "501": {
            "$ref": "#/components/responses/Error501"
          },
          "503": {
            "$ref": "#/components/responses/Error503"
          }
        },
        "x-scope": "documents.read",
        "x-rate-class": "read",
        "x-error-codes": {
          "400": [
            "VALIDATION_FAILED"
          ],
          "401": [
            "UNAUTHENTICATED"
          ],
          "403": [
            "FORBIDDEN",
            "ACCESS_EXPIRED"
          ],
          "404": [
            "NOT_FOUND"
          ],
          "405": [
            "METHOD_NOT_ALLOWED"
          ],
          "429": [
            "RATE_LIMITED"
          ],
          "500": [
            "INTERNAL"
          ],
          "501": [
            "NOT_IMPLEMENTED"
          ],
          "503": [
            "SERVICE_UNAVAILABLE"
          ]
        }
      }
    },
    "/v1/businesses/{businessId}/customers": {
      "get": {
        "operationId": "customers.list",
        "tags": [
          "customers"
        ],
        "summary": "Search the customers.",
        "description": "API key with the scope `customers.read` (the creator's current role must hold it too).",
        "security": [
          {
            "apiKey": [
              "customers.read"
            ]
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 100
            }
          },
          {
            "name": "archived",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "true",
                "false"
              ]
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 512
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "default": 25,
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "const": true
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "items": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/Customer"
                          }
                        },
                        "nextCursor": {
                          "anyOf": [
                            {
                              "type": "string",
                              "maxLength": 512
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      },
                      "required": [
                        "items",
                        "nextCursor"
                      ]
                    },
                    "requestId": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "ok",
                    "data",
                    "requestId"
                  ]
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error400"
          },
          "401": {
            "$ref": "#/components/responses/Error401"
          },
          "403": {
            "$ref": "#/components/responses/Error403"
          },
          "404": {
            "$ref": "#/components/responses/Error404"
          },
          "405": {
            "$ref": "#/components/responses/Error405"
          },
          "429": {
            "$ref": "#/components/responses/Error429"
          },
          "500": {
            "$ref": "#/components/responses/Error500"
          },
          "501": {
            "$ref": "#/components/responses/Error501"
          },
          "503": {
            "$ref": "#/components/responses/Error503"
          }
        },
        "x-scope": "customers.read",
        "x-rate-class": "read",
        "x-error-codes": {
          "400": [
            "VALIDATION_FAILED"
          ],
          "401": [
            "UNAUTHENTICATED"
          ],
          "403": [
            "FORBIDDEN",
            "ACCESS_EXPIRED"
          ],
          "404": [
            "NOT_FOUND"
          ],
          "405": [
            "METHOD_NOT_ALLOWED"
          ],
          "429": [
            "RATE_LIMITED"
          ],
          "500": [
            "INTERNAL"
          ],
          "501": [
            "NOT_IMPLEMENTED"
          ],
          "503": [
            "SERVICE_UNAVAILABLE"
          ]
        }
      },
      "post": {
        "operationId": "customers.create",
        "tags": [
          "customers"
        ],
        "summary": "Add a customer. The server gives it a customer code that never changes.",
        "description": "API key with the scope `customers.write` (the creator's current role must hold it too). Needs an `Idempotency-Key`, so it counts among the 60 requests with an `Idempotency-Key` a key may make in a minute. The body is JSON (`Content-Type: application/json`) of at most 1 MiB.",
        "security": [
          {
            "apiKey": [
              "customers.write"
            ]
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CustomerInput"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/Customer"
                    },
                    "requestId": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "ok",
                    "data",
                    "requestId"
                  ]
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error400"
          },
          "401": {
            "$ref": "#/components/responses/Error401"
          },
          "403": {
            "$ref": "#/components/responses/Error403"
          },
          "404": {
            "$ref": "#/components/responses/Error404"
          },
          "405": {
            "$ref": "#/components/responses/Error405"
          },
          "409": {
            "$ref": "#/components/responses/Error409"
          },
          "413": {
            "$ref": "#/components/responses/Error413"
          },
          "415": {
            "$ref": "#/components/responses/Error415"
          },
          "422": {
            "$ref": "#/components/responses/Error422"
          },
          "429": {
            "$ref": "#/components/responses/Error429"
          },
          "500": {
            "$ref": "#/components/responses/Error500"
          },
          "501": {
            "$ref": "#/components/responses/Error501"
          },
          "503": {
            "$ref": "#/components/responses/Error503"
          }
        },
        "x-scope": "customers.write",
        "x-rate-class": "write",
        "x-error-codes": {
          "400": [
            "VALIDATION_FAILED",
            "IDEMPOTENCY_KEY_REQUIRED"
          ],
          "401": [
            "UNAUTHENTICATED"
          ],
          "403": [
            "FORBIDDEN",
            "ACCESS_EXPIRED"
          ],
          "404": [
            "NOT_FOUND"
          ],
          "405": [
            "METHOD_NOT_ALLOWED"
          ],
          "409": [
            "BUSINESS_READ_ONLY",
            "IDEMPOTENCY_REQUEST_IN_PROGRESS"
          ],
          "413": [
            "PAYLOAD_TOO_LARGE"
          ],
          "415": [
            "UNSUPPORTED_MEDIA_TYPE"
          ],
          "422": [
            "IDEMPOTENCY_KEY_REUSED"
          ],
          "429": [
            "RATE_LIMITED"
          ],
          "500": [
            "INTERNAL"
          ],
          "501": [
            "NOT_IMPLEMENTED"
          ],
          "503": [
            "SERVICE_UNAVAILABLE"
          ]
        }
      }
    },
    "/v1/businesses/{businessId}/customers/{customerId}": {
      "get": {
        "operationId": "customers.get",
        "tags": [
          "customers"
        ],
        "summary": "One customer.",
        "description": "API key with the scope `customers.read` (the creator's current role must hold it too).",
        "security": [
          {
            "apiKey": [
              "customers.read"
            ]
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "customerId",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/Customer"
                    },
                    "requestId": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "ok",
                    "data",
                    "requestId"
                  ]
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error400"
          },
          "401": {
            "$ref": "#/components/responses/Error401"
          },
          "403": {
            "$ref": "#/components/responses/Error403"
          },
          "404": {
            "$ref": "#/components/responses/Error404"
          },
          "405": {
            "$ref": "#/components/responses/Error405"
          },
          "429": {
            "$ref": "#/components/responses/Error429"
          },
          "500": {
            "$ref": "#/components/responses/Error500"
          },
          "501": {
            "$ref": "#/components/responses/Error501"
          },
          "503": {
            "$ref": "#/components/responses/Error503"
          }
        },
        "x-scope": "customers.read",
        "x-rate-class": "read",
        "x-error-codes": {
          "400": [
            "VALIDATION_FAILED"
          ],
          "401": [
            "UNAUTHENTICATED"
          ],
          "403": [
            "FORBIDDEN",
            "ACCESS_EXPIRED"
          ],
          "404": [
            "NOT_FOUND"
          ],
          "405": [
            "METHOD_NOT_ALLOWED"
          ],
          "429": [
            "RATE_LIMITED"
          ],
          "500": [
            "INTERNAL"
          ],
          "501": [
            "NOT_IMPLEMENTED"
          ],
          "503": [
            "SERVICE_UNAVAILABLE"
          ]
        }
      },
      "put": {
        "operationId": "customers.update",
        "tags": [
          "customers"
        ],
        "summary": "Replace a customer’s details. Issued documents keep the details they were issued with.",
        "description": "API key with the scope `customers.write` (the creator's current role must hold it too). Needs an `Idempotency-Key`, so it counts among the 60 requests with an `Idempotency-Key` a key may make in a minute. The body is JSON (`Content-Type: application/json`) of at most 1 MiB.",
        "security": [
          {
            "apiKey": [
              "customers.write"
            ]
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "customerId",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CustomerInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/Customer"
                    },
                    "requestId": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "ok",
                    "data",
                    "requestId"
                  ]
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error400"
          },
          "401": {
            "$ref": "#/components/responses/Error401"
          },
          "403": {
            "$ref": "#/components/responses/Error403"
          },
          "404": {
            "$ref": "#/components/responses/Error404"
          },
          "405": {
            "$ref": "#/components/responses/Error405"
          },
          "409": {
            "$ref": "#/components/responses/Error409"
          },
          "413": {
            "$ref": "#/components/responses/Error413"
          },
          "415": {
            "$ref": "#/components/responses/Error415"
          },
          "422": {
            "$ref": "#/components/responses/Error422"
          },
          "429": {
            "$ref": "#/components/responses/Error429"
          },
          "500": {
            "$ref": "#/components/responses/Error500"
          },
          "501": {
            "$ref": "#/components/responses/Error501"
          },
          "503": {
            "$ref": "#/components/responses/Error503"
          }
        },
        "x-scope": "customers.write",
        "x-rate-class": "write",
        "x-error-codes": {
          "400": [
            "VALIDATION_FAILED",
            "IDEMPOTENCY_KEY_REQUIRED"
          ],
          "401": [
            "UNAUTHENTICATED"
          ],
          "403": [
            "FORBIDDEN",
            "ACCESS_EXPIRED"
          ],
          "404": [
            "NOT_FOUND"
          ],
          "405": [
            "METHOD_NOT_ALLOWED"
          ],
          "409": [
            "BUSINESS_READ_ONLY",
            "IDEMPOTENCY_REQUEST_IN_PROGRESS"
          ],
          "413": [
            "PAYLOAD_TOO_LARGE"
          ],
          "415": [
            "UNSUPPORTED_MEDIA_TYPE"
          ],
          "422": [
            "IDEMPOTENCY_KEY_REUSED"
          ],
          "429": [
            "RATE_LIMITED"
          ],
          "500": [
            "INTERNAL"
          ],
          "501": [
            "NOT_IMPLEMENTED"
          ],
          "503": [
            "SERVICE_UNAVAILABLE"
          ]
        }
      }
    },
    "/v1/businesses/{businessId}/customers/{customerId}/archive": {
      "post": {
        "operationId": "customers.archive",
        "tags": [
          "customers"
        ],
        "summary": "Archive a customer: hidden when choosing a customer for a new document, never deleted.",
        "description": "API key with the scope `customers.write` (the creator's current role must hold it too). Needs an `Idempotency-Key`, so it counts among the 60 requests with an `Idempotency-Key` a key may make in a minute.",
        "security": [
          {
            "apiKey": [
              "customers.write"
            ]
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "customerId",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/Customer"
                    },
                    "requestId": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "ok",
                    "data",
                    "requestId"
                  ]
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error400"
          },
          "401": {
            "$ref": "#/components/responses/Error401"
          },
          "403": {
            "$ref": "#/components/responses/Error403"
          },
          "404": {
            "$ref": "#/components/responses/Error404"
          },
          "405": {
            "$ref": "#/components/responses/Error405"
          },
          "409": {
            "$ref": "#/components/responses/Error409"
          },
          "422": {
            "$ref": "#/components/responses/Error422"
          },
          "429": {
            "$ref": "#/components/responses/Error429"
          },
          "500": {
            "$ref": "#/components/responses/Error500"
          },
          "501": {
            "$ref": "#/components/responses/Error501"
          },
          "503": {
            "$ref": "#/components/responses/Error503"
          }
        },
        "x-scope": "customers.write",
        "x-rate-class": "write",
        "x-error-codes": {
          "400": [
            "VALIDATION_FAILED",
            "IDEMPOTENCY_KEY_REQUIRED"
          ],
          "401": [
            "UNAUTHENTICATED"
          ],
          "403": [
            "FORBIDDEN",
            "ACCESS_EXPIRED"
          ],
          "404": [
            "NOT_FOUND"
          ],
          "405": [
            "METHOD_NOT_ALLOWED"
          ],
          "409": [
            "BUSINESS_READ_ONLY",
            "IDEMPOTENCY_REQUEST_IN_PROGRESS"
          ],
          "422": [
            "IDEMPOTENCY_KEY_REUSED"
          ],
          "429": [
            "RATE_LIMITED"
          ],
          "500": [
            "INTERNAL"
          ],
          "501": [
            "NOT_IMPLEMENTED"
          ],
          "503": [
            "SERVICE_UNAVAILABLE"
          ]
        }
      }
    },
    "/v1/businesses/{businessId}/customers/{customerId}/ledger": {
      "get": {
        "operationId": "reports.customerLedger",
        "tags": [
          "reports"
        ],
        "summary": "One customer’s ledger for a period: the opening balance, each document with its running balance, the closing balance and the open documents.",
        "description": "API key with the scope `documents.read` (the creator's current role must hold it too). Heavy: at most 10 a minute per key.",
        "security": [
          {
            "apiKey": [
              "documents.read"
            ]
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "customerId",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "from",
            "in": "query",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/LocalDate"
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/LocalDate"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/CustomerLedger"
                    },
                    "requestId": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "ok",
                    "data",
                    "requestId"
                  ]
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error400"
          },
          "401": {
            "$ref": "#/components/responses/Error401"
          },
          "403": {
            "$ref": "#/components/responses/Error403"
          },
          "404": {
            "$ref": "#/components/responses/Error404"
          },
          "405": {
            "$ref": "#/components/responses/Error405"
          },
          "429": {
            "$ref": "#/components/responses/Error429"
          },
          "500": {
            "$ref": "#/components/responses/Error500"
          },
          "501": {
            "$ref": "#/components/responses/Error501"
          },
          "503": {
            "$ref": "#/components/responses/Error503"
          }
        },
        "x-scope": "documents.read",
        "x-rate-class": "heavy",
        "x-error-codes": {
          "400": [
            "VALIDATION_FAILED"
          ],
          "401": [
            "UNAUTHENTICATED"
          ],
          "403": [
            "FORBIDDEN",
            "ACCESS_EXPIRED"
          ],
          "404": [
            "NOT_FOUND"
          ],
          "405": [
            "METHOD_NOT_ALLOWED"
          ],
          "429": [
            "RATE_LIMITED"
          ],
          "500": [
            "INTERNAL"
          ],
          "501": [
            "NOT_IMPLEMENTED"
          ],
          "503": [
            "SERVICE_UNAVAILABLE"
          ]
        }
      }
    },
    "/v1/businesses/{businessId}/customers/{customerId}/preferences": {
      "get": {
        "operationId": "customers.getPreferences",
        "tags": [
          "customers"
        ],
        "summary": "The customer’s preferences for new documents: payment terms, currency, sending after the issue (the defaults when never set).",
        "description": "API key with the scope `customers.read` (the creator's current role must hold it too).",
        "security": [
          {
            "apiKey": [
              "customers.read"
            ]
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "customerId",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "const": true
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "customerId": {
                          "$ref": "#/components/schemas/Id"
                        },
                        "paymentTerms": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "enum": [
                                    "net_days",
                                    "end_of_month_plus"
                                  ]
                                },
                                "days": {
                                  "type": "integer",
                                  "minimum": 0,
                                  "maximum": 365
                                }
                              },
                              "required": [
                                "kind",
                                "days"
                              ]
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "currency": {
                          "anyOf": [
                            {
                              "$ref": "#/components/schemas/CurrencyCode"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "sendAfterIssue": {
                          "type": "boolean"
                        },
                        "updatedAt": {
                          "anyOf": [
                            {
                              "$ref": "#/components/schemas/Timestamp"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      },
                      "required": [
                        "customerId",
                        "paymentTerms",
                        "currency",
                        "sendAfterIssue",
                        "updatedAt"
                      ]
                    },
                    "requestId": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "ok",
                    "data",
                    "requestId"
                  ]
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error400"
          },
          "401": {
            "$ref": "#/components/responses/Error401"
          },
          "403": {
            "$ref": "#/components/responses/Error403"
          },
          "404": {
            "$ref": "#/components/responses/Error404"
          },
          "405": {
            "$ref": "#/components/responses/Error405"
          },
          "429": {
            "$ref": "#/components/responses/Error429"
          },
          "500": {
            "$ref": "#/components/responses/Error500"
          },
          "501": {
            "$ref": "#/components/responses/Error501"
          },
          "503": {
            "$ref": "#/components/responses/Error503"
          }
        },
        "x-scope": "customers.read",
        "x-rate-class": "read",
        "x-error-codes": {
          "400": [
            "VALIDATION_FAILED"
          ],
          "401": [
            "UNAUTHENTICATED"
          ],
          "403": [
            "FORBIDDEN",
            "ACCESS_EXPIRED"
          ],
          "404": [
            "NOT_FOUND"
          ],
          "405": [
            "METHOD_NOT_ALLOWED"
          ],
          "429": [
            "RATE_LIMITED"
          ],
          "500": [
            "INTERNAL"
          ],
          "501": [
            "NOT_IMPLEMENTED"
          ],
          "503": [
            "SERVICE_UNAVAILABLE"
          ]
        }
      },
      "put": {
        "operationId": "customers.updatePreferences",
        "tags": [
          "customers"
        ],
        "summary": "Replace the customer’s preferences for new documents. They only fill in new drafts; issued documents keep theirs.",
        "description": "API key with the scope `customers.write` (the creator's current role must hold it too). Needs an `Idempotency-Key`, so it counts among the 60 requests with an `Idempotency-Key` a key may make in a minute. The body is JSON (`Content-Type: application/json`) of at most 1 MiB.",
        "security": [
          {
            "apiKey": [
              "customers.write"
            ]
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "customerId",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "paymentTerms": {
                    "default": null,
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "type": "string",
                            "enum": [
                              "net_days",
                              "end_of_month_plus"
                            ]
                          },
                          "days": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 365
                          }
                        },
                        "required": [
                          "kind",
                          "days"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "currency": {
                    "default": null,
                    "anyOf": [
                      {
                        "$ref": "#/components/schemas/CurrencyCode"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "sendAfterIssue": {
                    "default": false,
                    "type": "boolean"
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "const": true
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "customerId": {
                          "$ref": "#/components/schemas/Id"
                        },
                        "paymentTerms": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "enum": [
                                    "net_days",
                                    "end_of_month_plus"
                                  ]
                                },
                                "days": {
                                  "type": "integer",
                                  "minimum": 0,
                                  "maximum": 365
                                }
                              },
                              "required": [
                                "kind",
                                "days"
                              ]
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "currency": {
                          "anyOf": [
                            {
                              "$ref": "#/components/schemas/CurrencyCode"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "sendAfterIssue": {
                          "type": "boolean"
                        },
                        "updatedAt": {
                          "anyOf": [
                            {
                              "$ref": "#/components/schemas/Timestamp"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      },
                      "required": [
                        "customerId",
                        "paymentTerms",
                        "currency",
                        "sendAfterIssue",
                        "updatedAt"
                      ]
                    },
                    "requestId": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "ok",
                    "data",
                    "requestId"
                  ]
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error400"
          },
          "401": {
            "$ref": "#/components/responses/Error401"
          },
          "403": {
            "$ref": "#/components/responses/Error403"
          },
          "404": {
            "$ref": "#/components/responses/Error404"
          },
          "405": {
            "$ref": "#/components/responses/Error405"
          },
          "409": {
            "$ref": "#/components/responses/Error409"
          },
          "413": {
            "$ref": "#/components/responses/Error413"
          },
          "415": {
            "$ref": "#/components/responses/Error415"
          },
          "422": {
            "$ref": "#/components/responses/Error422"
          },
          "429": {
            "$ref": "#/components/responses/Error429"
          },
          "500": {
            "$ref": "#/components/responses/Error500"
          },
          "501": {
            "$ref": "#/components/responses/Error501"
          },
          "503": {
            "$ref": "#/components/responses/Error503"
          }
        },
        "x-scope": "customers.write",
        "x-rate-class": "write",
        "x-error-codes": {
          "400": [
            "VALIDATION_FAILED",
            "IDEMPOTENCY_KEY_REQUIRED"
          ],
          "401": [
            "UNAUTHENTICATED"
          ],
          "403": [
            "FORBIDDEN",
            "ACCESS_EXPIRED"
          ],
          "404": [
            "NOT_FOUND"
          ],
          "405": [
            "METHOD_NOT_ALLOWED"
          ],
          "409": [
            "BUSINESS_READ_ONLY",
            "IDEMPOTENCY_REQUEST_IN_PROGRESS"
          ],
          "413": [
            "PAYLOAD_TOO_LARGE"
          ],
          "415": [
            "UNSUPPORTED_MEDIA_TYPE"
          ],
          "422": [
            "IDEMPOTENCY_KEY_REUSED"
          ],
          "429": [
            "RATE_LIMITED"
          ],
          "500": [
            "INTERNAL"
          ],
          "501": [
            "NOT_IMPLEMENTED"
          ],
          "503": [
            "SERVICE_UNAVAILABLE"
          ]
        }
      }
    },
    "/v1/businesses/{businessId}/customers/{customerId}/unarchive": {
      "post": {
        "operationId": "customers.unarchive",
        "tags": [
          "customers"
        ],
        "summary": "Bring an archived customer back.",
        "description": "API key with the scope `customers.write` (the creator's current role must hold it too). Needs an `Idempotency-Key`, so it counts among the 60 requests with an `Idempotency-Key` a key may make in a minute.",
        "security": [
          {
            "apiKey": [
              "customers.write"
            ]
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "customerId",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/Customer"
                    },
                    "requestId": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "ok",
                    "data",
                    "requestId"
                  ]
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error400"
          },
          "401": {
            "$ref": "#/components/responses/Error401"
          },
          "403": {
            "$ref": "#/components/responses/Error403"
          },
          "404": {
            "$ref": "#/components/responses/Error404"
          },
          "405": {
            "$ref": "#/components/responses/Error405"
          },
          "409": {
            "$ref": "#/components/responses/Error409"
          },
          "422": {
            "$ref": "#/components/responses/Error422"
          },
          "429": {
            "$ref": "#/components/responses/Error429"
          },
          "500": {
            "$ref": "#/components/responses/Error500"
          },
          "501": {
            "$ref": "#/components/responses/Error501"
          },
          "503": {
            "$ref": "#/components/responses/Error503"
          }
        },
        "x-scope": "customers.write",
        "x-rate-class": "write",
        "x-error-codes": {
          "400": [
            "VALIDATION_FAILED",
            "IDEMPOTENCY_KEY_REQUIRED"
          ],
          "401": [
            "UNAUTHENTICATED"
          ],
          "403": [
            "FORBIDDEN",
            "ACCESS_EXPIRED"
          ],
          "404": [
            "NOT_FOUND"
          ],
          "405": [
            "METHOD_NOT_ALLOWED"
          ],
          "409": [
            "BUSINESS_READ_ONLY",
            "IDEMPOTENCY_REQUEST_IN_PROGRESS"
          ],
          "422": [
            "IDEMPOTENCY_KEY_REUSED"
          ],
          "429": [
            "RATE_LIMITED"
          ],
          "500": [
            "INTERNAL"
          ],
          "501": [
            "NOT_IMPLEMENTED"
          ],
          "503": [
            "SERVICE_UNAVAILABLE"
          ]
        }
      }
    },
    "/v1/businesses/{businessId}/documents": {
      "get": {
        "operationId": "documents.list",
        "tags": [
          "documents"
        ],
        "summary": "Drafts and issued documents. Newest document date first; within one date in id order, not by creation or last change. To find new documents, read every page of the dates in question (`from`, `to`) and sort by `issuedAt` or `number`. The cursor is opaque: send `nextCursor` back exactly as received; any other cursor answers VALIDATION_FAILED.",
        "description": "API key with the scope `documents.read` (the creator's current role must hold it too). A key's query is `PublicApiDocumentListQuery` (narrower than the app's). A key's answer is `PublicApiDocumentPage`, narrower than the app's: what it does not hold never reaches a key. `q` matches an allocation or approval number only by its last digits, at most the 9 the document prints; a longer run of digits never matches one.",
        "security": [
          {
            "apiKey": [
              "documents.read"
            ]
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 512
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "default": 25,
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "type",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/DocumentType"
            }
          },
          {
            "name": "variant",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/DocumentVariant"
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/DocumentStatus"
            }
          },
          {
            "name": "customerId",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "from",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/LocalDate"
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/LocalDate"
            }
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/PublicApiDocumentPage"
                    },
                    "requestId": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "ok",
                    "data",
                    "requestId"
                  ]
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error400"
          },
          "401": {
            "$ref": "#/components/responses/Error401"
          },
          "403": {
            "$ref": "#/components/responses/Error403"
          },
          "404": {
            "$ref": "#/components/responses/Error404"
          },
          "405": {
            "$ref": "#/components/responses/Error405"
          },
          "429": {
            "$ref": "#/components/responses/Error429"
          },
          "500": {
            "$ref": "#/components/responses/Error500"
          },
          "501": {
            "$ref": "#/components/responses/Error501"
          },
          "503": {
            "$ref": "#/components/responses/Error503"
          }
        },
        "x-scope": "documents.read",
        "x-rate-class": "read",
        "x-error-codes": {
          "400": [
            "VALIDATION_FAILED"
          ],
          "401": [
            "UNAUTHENTICATED"
          ],
          "403": [
            "FORBIDDEN",
            "ACCESS_EXPIRED"
          ],
          "404": [
            "NOT_FOUND"
          ],
          "405": [
            "METHOD_NOT_ALLOWED"
          ],
          "429": [
            "RATE_LIMITED"
          ],
          "500": [
            "INTERNAL"
          ],
          "501": [
            "NOT_IMPLEMENTED"
          ],
          "503": [
            "SERVICE_UNAVAILABLE"
          ]
        },
        "x-narrowed": [
          "query",
          "response"
        ]
      }
    },
    "/v1/businesses/{businessId}/documents/compute": {
      "post": {
        "operationId": "documents.compute",
        "tags": [
          "documents"
        ],
        "summary": "Compute a draft — totals, VAT, warnings and whether an allocation number is needed — without saving it.",
        "description": "API key with the issuing capability (\"הפקת מסמכים\"; permissions `documents.write`, `documents.issue`), which only the business's owner creates. This route needs `documents.write`. The key must also hold `documents.read` and `customers.read`. A key's body is `PublicApiDocumentDraftInput` (narrower than the app's). The body is JSON (`Content-Type: application/json`) of at most 1 MiB.",
        "security": [
          {
            "apiKey": [
              "documents.write"
            ]
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PublicApiDocumentDraftInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/DocumentComputationResult"
                    },
                    "requestId": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "ok",
                    "data",
                    "requestId"
                  ]
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error400"
          },
          "401": {
            "$ref": "#/components/responses/Error401"
          },
          "403": {
            "$ref": "#/components/responses/Error403"
          },
          "404": {
            "$ref": "#/components/responses/Error404"
          },
          "405": {
            "$ref": "#/components/responses/Error405"
          },
          "409": {
            "$ref": "#/components/responses/Error409"
          },
          "413": {
            "$ref": "#/components/responses/Error413"
          },
          "415": {
            "$ref": "#/components/responses/Error415"
          },
          "429": {
            "$ref": "#/components/responses/Error429"
          },
          "500": {
            "$ref": "#/components/responses/Error500"
          },
          "501": {
            "$ref": "#/components/responses/Error501"
          },
          "503": {
            "$ref": "#/components/responses/Error503"
          }
        },
        "x-scope": "documents.write",
        "x-rate-class": "read",
        "x-error-codes": {
          "400": [
            "VALIDATION_FAILED"
          ],
          "401": [
            "UNAUTHENTICATED"
          ],
          "403": [
            "FORBIDDEN",
            "ACCESS_EXPIRED"
          ],
          "404": [
            "NOT_FOUND"
          ],
          "405": [
            "METHOD_NOT_ALLOWED"
          ],
          "409": [
            "BUSINESS_READ_ONLY"
          ],
          "413": [
            "PAYLOAD_TOO_LARGE"
          ],
          "415": [
            "UNSUPPORTED_MEDIA_TYPE"
          ],
          "429": [
            "RATE_LIMITED"
          ],
          "500": [
            "INTERNAL"
          ],
          "501": [
            "NOT_IMPLEMENTED"
          ],
          "503": [
            "SERVICE_UNAVAILABLE"
          ]
        },
        "x-issuing": true,
        "x-narrowed": [
          "body"
        ]
      }
    },
    "/v1/businesses/{businessId}/documents/search": {
      "get": {
        "operationId": "documents.search",
        "tags": [
          "documents"
        ],
        "summary": "The documents list with every filter: the list’s filters plus the amount, the payment method and cancelled; the first page counts the matches. Newest document date first; within one date in id order, not by creation or last change. To find new documents, read every page of the dates in question (`from`, `to`) and sort by `issuedAt` or `number`. The cursor is opaque: send `nextCursor` back exactly as received; any other cursor answers VALIDATION_FAILED.",
        "description": "API key with the scope `documents.read` (the creator's current role must hold it too). A key's query is `PublicApiDocumentSearchQuery` (narrower than the app's). A key's answer is `PublicApiDocumentSearchPage`, narrower than the app's: what it does not hold never reaches a key. `q` matches an allocation or approval number only by its last digits, at most the 9 the document prints; a longer run of digits never matches one.",
        "security": [
          {
            "apiKey": [
              "documents.read"
            ]
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 512
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "default": 25,
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "type",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/DocumentType"
            }
          },
          {
            "name": "variant",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/DocumentVariant"
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/DocumentStatus"
            }
          },
          {
            "name": "customerId",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "from",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/LocalDate"
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/LocalDate"
            }
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 100
            }
          },
          {
            "name": "amountFrom",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 0,
              "maximum": 99999999999999
            }
          },
          {
            "name": "amountTo",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 0,
              "maximum": 99999999999999
            }
          },
          {
            "name": "paymentMethod",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/PaymentMethod"
            }
          },
          {
            "name": "cancelled",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "only",
                "exclude"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/PublicApiDocumentSearchPage"
                    },
                    "requestId": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "ok",
                    "data",
                    "requestId"
                  ]
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error400"
          },
          "401": {
            "$ref": "#/components/responses/Error401"
          },
          "403": {
            "$ref": "#/components/responses/Error403"
          },
          "404": {
            "$ref": "#/components/responses/Error404"
          },
          "405": {
            "$ref": "#/components/responses/Error405"
          },
          "429": {
            "$ref": "#/components/responses/Error429"
          },
          "500": {
            "$ref": "#/components/responses/Error500"
          },
          "501": {
            "$ref": "#/components/responses/Error501"
          },
          "503": {
            "$ref": "#/components/responses/Error503"
          }
        },
        "x-scope": "documents.read",
        "x-rate-class": "read",
        "x-error-codes": {
          "400": [
            "VALIDATION_FAILED"
          ],
          "401": [
            "UNAUTHENTICATED"
          ],
          "403": [
            "FORBIDDEN",
            "ACCESS_EXPIRED"
          ],
          "404": [
            "NOT_FOUND"
          ],
          "405": [
            "METHOD_NOT_ALLOWED"
          ],
          "429": [
            "RATE_LIMITED"
          ],
          "500": [
            "INTERNAL"
          ],
          "501": [
            "NOT_IMPLEMENTED"
          ],
          "503": [
            "SERVICE_UNAVAILABLE"
          ]
        },
        "x-narrowed": [
          "query",
          "response"
        ]
      }
    },
    "/v1/businesses/{businessId}/documents/{documentId}": {
      "get": {
        "operationId": "documents.get",
        "tags": [
          "documents"
        ],
        "summary": "A draft or an issued document. It carries no file: a PDF copy is made with `documents.createRendition` (purpose `business_copy`).",
        "description": "API key with the scope `documents.read` (the creator's current role must hold it too). A key's answer is `PublicApiDocument`, narrower than the app's: what it does not hold never reaches a key.",
        "security": [
          {
            "apiKey": [
              "documents.read"
            ]
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "documentId",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/PublicApiDocument"
                    },
                    "requestId": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "ok",
                    "data",
                    "requestId"
                  ]
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error400"
          },
          "401": {
            "$ref": "#/components/responses/Error401"
          },
          "403": {
            "$ref": "#/components/responses/Error403"
          },
          "404": {
            "$ref": "#/components/responses/Error404"
          },
          "405": {
            "$ref": "#/components/responses/Error405"
          },
          "429": {
            "$ref": "#/components/responses/Error429"
          },
          "500": {
            "$ref": "#/components/responses/Error500"
          },
          "501": {
            "$ref": "#/components/responses/Error501"
          },
          "503": {
            "$ref": "#/components/responses/Error503"
          }
        },
        "x-scope": "documents.read",
        "x-rate-class": "read",
        "x-error-codes": {
          "400": [
            "VALIDATION_FAILED"
          ],
          "401": [
            "UNAUTHENTICATED"
          ],
          "403": [
            "FORBIDDEN",
            "ACCESS_EXPIRED"
          ],
          "404": [
            "NOT_FOUND"
          ],
          "405": [
            "METHOD_NOT_ALLOWED"
          ],
          "429": [
            "RATE_LIMITED"
          ],
          "500": [
            "INTERNAL"
          ],
          "501": [
            "NOT_IMPLEMENTED"
          ],
          "503": [
            "SERVICE_UNAVAILABLE"
          ]
        },
        "x-narrowed": [
          "response"
        ]
      },
      "put": {
        "operationId": "documents.saveDraft",
        "tags": [
          "documents"
        ],
        "summary": "Create or replace a draft under an id the caller makes (a new random UUID for each new draft). An issued document never changes.",
        "description": "API key with the issuing capability (\"הפקת מסמכים\"; permissions `documents.write`, `documents.issue`), which only the business's owner creates. This route needs `documents.write`. The key must also hold `documents.read` and `customers.read`. A key's body is `PublicApiDocumentDraftInput` (narrower than the app's). A key's answer is `PublicApiDraftDocument`, narrower than the app's: what it does not hold never reaches a key. Needs an `Idempotency-Key`, so it counts among the 60 requests with an `Idempotency-Key` a key may make in a minute. The body is JSON (`Content-Type: application/json`) of at most 1 MiB.",
        "security": [
          {
            "apiKey": [
              "documents.write"
            ]
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "documentId",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PublicApiDocumentDraftInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/PublicApiDraftDocument"
                    },
                    "requestId": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "ok",
                    "data",
                    "requestId"
                  ]
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error400"
          },
          "401": {
            "$ref": "#/components/responses/Error401"
          },
          "403": {
            "$ref": "#/components/responses/Error403"
          },
          "404": {
            "$ref": "#/components/responses/Error404"
          },
          "405": {
            "$ref": "#/components/responses/Error405"
          },
          "409": {
            "$ref": "#/components/responses/Error409"
          },
          "413": {
            "$ref": "#/components/responses/Error413"
          },
          "415": {
            "$ref": "#/components/responses/Error415"
          },
          "422": {
            "$ref": "#/components/responses/Error422"
          },
          "429": {
            "$ref": "#/components/responses/Error429"
          },
          "500": {
            "$ref": "#/components/responses/Error500"
          },
          "501": {
            "$ref": "#/components/responses/Error501"
          },
          "503": {
            "$ref": "#/components/responses/Error503"
          }
        },
        "x-scope": "documents.write",
        "x-rate-class": "write",
        "x-error-codes": {
          "400": [
            "VALIDATION_FAILED",
            "IDEMPOTENCY_KEY_REQUIRED"
          ],
          "401": [
            "UNAUTHENTICATED"
          ],
          "403": [
            "FORBIDDEN",
            "ACCESS_EXPIRED"
          ],
          "404": [
            "NOT_FOUND"
          ],
          "405": [
            "METHOD_NOT_ALLOWED"
          ],
          "409": [
            "BUSINESS_READ_ONLY",
            "IDEMPOTENCY_REQUEST_IN_PROGRESS",
            "DOCUMENT_IMMUTABLE"
          ],
          "413": [
            "PAYLOAD_TOO_LARGE"
          ],
          "415": [
            "UNSUPPORTED_MEDIA_TYPE"
          ],
          "422": [
            "IDEMPOTENCY_KEY_REUSED",
            "DOCUMENT_TYPE_NOT_ALLOWED"
          ],
          "429": [
            "RATE_LIMITED"
          ],
          "500": [
            "INTERNAL"
          ],
          "501": [
            "NOT_IMPLEMENTED"
          ],
          "503": [
            "SERVICE_UNAVAILABLE"
          ]
        },
        "x-issuing": true,
        "x-narrowed": [
          "body",
          "response"
        ]
      },
      "delete": {
        "operationId": "documents.deleteDraft",
        "tags": [
          "documents"
        ],
        "summary": "Delete a draft. An issued document is never deleted.",
        "description": "API key with the issuing capability (\"הפקת מסמכים\"; permissions `documents.write`, `documents.issue`), which only the business's owner creates. This route needs `documents.write`. The key must also hold `documents.read` and `customers.read`. Needs an `Idempotency-Key`, so it counts among the 60 requests with an `Idempotency-Key` a key may make in a minute.",
        "security": [
          {
            "apiKey": [
              "documents.write"
            ]
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "documentId",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/Done"
                    },
                    "requestId": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "ok",
                    "data",
                    "requestId"
                  ]
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error400"
          },
          "401": {
            "$ref": "#/components/responses/Error401"
          },
          "403": {
            "$ref": "#/components/responses/Error403"
          },
          "404": {
            "$ref": "#/components/responses/Error404"
          },
          "405": {
            "$ref": "#/components/responses/Error405"
          },
          "409": {
            "$ref": "#/components/responses/Error409"
          },
          "422": {
            "$ref": "#/components/responses/Error422"
          },
          "429": {
            "$ref": "#/components/responses/Error429"
          },
          "500": {
            "$ref": "#/components/responses/Error500"
          },
          "501": {
            "$ref": "#/components/responses/Error501"
          },
          "503": {
            "$ref": "#/components/responses/Error503"
          }
        },
        "x-scope": "documents.write",
        "x-rate-class": "write",
        "x-error-codes": {
          "400": [
            "VALIDATION_FAILED",
            "IDEMPOTENCY_KEY_REQUIRED"
          ],
          "401": [
            "UNAUTHENTICATED"
          ],
          "403": [
            "FORBIDDEN",
            "ACCESS_EXPIRED"
          ],
          "404": [
            "NOT_FOUND"
          ],
          "405": [
            "METHOD_NOT_ALLOWED"
          ],
          "409": [
            "BUSINESS_READ_ONLY",
            "IDEMPOTENCY_REQUEST_IN_PROGRESS",
            "DOCUMENT_IMMUTABLE"
          ],
          "422": [
            "IDEMPOTENCY_KEY_REUSED"
          ],
          "429": [
            "RATE_LIMITED"
          ],
          "500": [
            "INTERNAL"
          ],
          "501": [
            "NOT_IMPLEMENTED"
          ],
          "503": [
            "SERVICE_UNAVAILABLE"
          ]
        },
        "x-issuing": true
      }
    },
    "/v1/businesses/{businessId}/documents/{documentId}/collection": {
      "get": {
        "operationId": "collections.getDocument",
        "tags": [
          "collections"
        ],
        "summary": "One document’s payment status, its closing by hand and its payment reminders (planned and sent).",
        "description": "API key with the scope `documents.read` (the creator's current role must hold it too). A key's answer is `PublicApiDocumentCollectionView`, narrower than the app's: what it does not hold never reaches a key. The reminder history tells a key when and how each reminder went out or did not, never why.",
        "security": [
          {
            "apiKey": [
              "documents.read"
            ]
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "documentId",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/PublicApiDocumentCollectionView"
                    },
                    "requestId": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "ok",
                    "data",
                    "requestId"
                  ]
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error400"
          },
          "401": {
            "$ref": "#/components/responses/Error401"
          },
          "403": {
            "$ref": "#/components/responses/Error403"
          },
          "404": {
            "$ref": "#/components/responses/Error404"
          },
          "405": {
            "$ref": "#/components/responses/Error405"
          },
          "429": {
            "$ref": "#/components/responses/Error429"
          },
          "500": {
            "$ref": "#/components/responses/Error500"
          },
          "501": {
            "$ref": "#/components/responses/Error501"
          },
          "503": {
            "$ref": "#/components/responses/Error503"
          }
        },
        "x-scope": "documents.read",
        "x-rate-class": "read",
        "x-error-codes": {
          "400": [
            "VALIDATION_FAILED"
          ],
          "401": [
            "UNAUTHENTICATED"
          ],
          "403": [
            "FORBIDDEN",
            "ACCESS_EXPIRED"
          ],
          "404": [
            "NOT_FOUND"
          ],
          "405": [
            "METHOD_NOT_ALLOWED"
          ],
          "429": [
            "RATE_LIMITED"
          ],
          "500": [
            "INTERNAL"
          ],
          "501": [
            "NOT_IMPLEMENTED"
          ],
          "503": [
            "SERVICE_UNAVAILABLE"
          ]
        },
        "x-narrowed": [
          "response"
        ]
      }
    },
    "/v1/businesses/{businessId}/documents/{documentId}/derive": {
      "post": {
        "operationId": "documents.derive",
        "tags": [
          "documents"
        ],
        "summary": "A new draft from an existing document: a credit note (all lines, some lines or an amount) of a tax invoice or a tax invoice / receipt, or the next document of a quote, an order, a delivery note or a payment demand.",
        "description": "API key with the issuing capability (\"הפקת מסמכים\"; permissions `documents.write`, `documents.issue`), which only the business's owner creates. This route needs `documents.write`. The key must also hold `documents.read` and `customers.read`. A key's answer is `PublicApiDraftDocument`, narrower than the app's: what it does not hold never reaches a key. Needs an `Idempotency-Key`, so it counts among the 60 requests with an `Idempotency-Key` a key may make in a minute. The body is JSON (`Content-Type: application/json`) of at most 1 MiB.",
        "security": [
          {
            "apiKey": [
              "documents.write"
            ]
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "documentId",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DeriveDocumentRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/PublicApiDraftDocument"
                    },
                    "requestId": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "ok",
                    "data",
                    "requestId"
                  ]
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error400"
          },
          "401": {
            "$ref": "#/components/responses/Error401"
          },
          "403": {
            "$ref": "#/components/responses/Error403"
          },
          "404": {
            "$ref": "#/components/responses/Error404"
          },
          "405": {
            "$ref": "#/components/responses/Error405"
          },
          "409": {
            "$ref": "#/components/responses/Error409"
          },
          "413": {
            "$ref": "#/components/responses/Error413"
          },
          "415": {
            "$ref": "#/components/responses/Error415"
          },
          "422": {
            "$ref": "#/components/responses/Error422"
          },
          "429": {
            "$ref": "#/components/responses/Error429"
          },
          "500": {
            "$ref": "#/components/responses/Error500"
          },
          "501": {
            "$ref": "#/components/responses/Error501"
          },
          "503": {
            "$ref": "#/components/responses/Error503"
          }
        },
        "x-scope": "documents.write",
        "x-rate-class": "write",
        "x-error-codes": {
          "400": [
            "VALIDATION_FAILED",
            "IDEMPOTENCY_KEY_REQUIRED"
          ],
          "401": [
            "UNAUTHENTICATED"
          ],
          "403": [
            "FORBIDDEN",
            "ACCESS_EXPIRED"
          ],
          "404": [
            "NOT_FOUND"
          ],
          "405": [
            "METHOD_NOT_ALLOWED"
          ],
          "409": [
            "BUSINESS_READ_ONLY",
            "IDEMPOTENCY_REQUEST_IN_PROGRESS",
            "CONFLICT"
          ],
          "413": [
            "PAYLOAD_TOO_LARGE"
          ],
          "415": [
            "UNSUPPORTED_MEDIA_TYPE"
          ],
          "422": [
            "IDEMPOTENCY_KEY_REUSED",
            "DOCUMENT_NOT_ISSUED",
            "DOCUMENT_TYPE_NOT_ALLOWED",
            "CREDIT_EXCEEDS_REMAINING"
          ],
          "429": [
            "RATE_LIMITED"
          ],
          "500": [
            "INTERNAL"
          ],
          "501": [
            "NOT_IMPLEMENTED"
          ],
          "503": [
            "SERVICE_UNAVAILABLE"
          ]
        },
        "x-issuing": true,
        "x-narrowed": [
          "response"
        ]
      }
    },
    "/v1/businesses/{businessId}/documents/{documentId}/issue": {
      "post": {
        "operationId": "documents.issue",
        "tags": [
          "documents"
        ],
        "summary": "Issue a draft as a real, final document of the business, with the next number of its series. When an allocation number is needed it is requested from the Tax Authority, and it arrives after this answer: read the document again.",
        "description": "API key with the issuing capability (\"הפקת מסמכים\"; permissions `documents.write`, `documents.issue`), which only the business's owner creates. This route needs `documents.issue`. The key must also hold `documents.read` and `customers.read`. A key's body is `PublicApiIssueDocumentRequest` (narrower than the app's). A key's answer is `PublicApiIssueDocumentResult`, narrower than the app's: what it does not hold never reaches a key. An issue: among the 60 requests with an `Idempotency-Key` a key may make in a minute, and at most 300 issue requests in a clock hour and 2000 in a UTC day per business, through all its keys (a sliding estimate of the issue requests that committed). The body is JSON (`Content-Type: application/json`) of at most 1 MiB.",
        "security": [
          {
            "apiKey": [
              "documents.issue"
            ]
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "documentId",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PublicApiIssueDocumentRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/PublicApiIssueDocumentResult"
                    },
                    "requestId": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "ok",
                    "data",
                    "requestId"
                  ]
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error400"
          },
          "401": {
            "$ref": "#/components/responses/Error401"
          },
          "403": {
            "$ref": "#/components/responses/Error403"
          },
          "404": {
            "$ref": "#/components/responses/Error404"
          },
          "405": {
            "$ref": "#/components/responses/Error405"
          },
          "409": {
            "$ref": "#/components/responses/Error409"
          },
          "413": {
            "$ref": "#/components/responses/Error413"
          },
          "415": {
            "$ref": "#/components/responses/Error415"
          },
          "422": {
            "$ref": "#/components/responses/Error422"
          },
          "429": {
            "$ref": "#/components/responses/Error429"
          },
          "500": {
            "$ref": "#/components/responses/Error500"
          },
          "501": {
            "$ref": "#/components/responses/Error501"
          },
          "503": {
            "$ref": "#/components/responses/Error503"
          }
        },
        "x-scope": "documents.issue",
        "x-rate-class": "issue",
        "x-error-codes": {
          "400": [
            "VALIDATION_FAILED",
            "IDEMPOTENCY_KEY_REQUIRED"
          ],
          "401": [
            "UNAUTHENTICATED"
          ],
          "403": [
            "FORBIDDEN",
            "ACCESS_EXPIRED",
            "SOFTWARE_NOT_REGISTERED"
          ],
          "404": [
            "NOT_FOUND"
          ],
          "405": [
            "METHOD_NOT_ALLOWED"
          ],
          "409": [
            "BUSINESS_READ_ONLY",
            "IDEMPOTENCY_REQUEST_IN_PROGRESS",
            "DOCUMENT_IMMUTABLE",
            "TOTALS_CHANGED",
            "CONFLICT"
          ],
          "413": [
            "PAYLOAD_TOO_LARGE"
          ],
          "415": [
            "UNSUPPORTED_MEDIA_TYPE"
          ],
          "422": [
            "IDEMPOTENCY_KEY_REUSED",
            "DOCUMENT_TYPE_NOT_ALLOWED",
            "CREDIT_EXCEEDS_REMAINING",
            "ALLOCATION_NOT_ELIGIBLE"
          ],
          "429": [
            "RATE_LIMITED"
          ],
          "500": [
            "INTERNAL"
          ],
          "501": [
            "NOT_IMPLEMENTED"
          ],
          "503": [
            "SERVICE_UNAVAILABLE"
          ]
        },
        "x-issuing": true,
        "x-narrowed": [
          "body",
          "response"
        ]
      }
    },
    "/v1/businesses/{businessId}/documents/{documentId}/renditions": {
      "get": {
        "operationId": "documents.listRenditions",
        "tags": [
          "documents"
        ],
        "summary": "The PDF copies of a document made on a request.",
        "description": "API key with the scope `documents.read` (the creator's current role must hold it too). A key's answer is `PublicApiRenditions`, narrower than the app's: what it does not hold never reaches a key. A key gets the business copies made on a request only (by its own `documents.createRendition` or a member’s); the copies the system stores by itself are left out.",
        "security": [
          {
            "apiKey": [
              "documents.read"
            ]
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "documentId",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/PublicApiRenditions"
                    },
                    "requestId": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "ok",
                    "data",
                    "requestId"
                  ]
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error400"
          },
          "401": {
            "$ref": "#/components/responses/Error401"
          },
          "403": {
            "$ref": "#/components/responses/Error403"
          },
          "404": {
            "$ref": "#/components/responses/Error404"
          },
          "405": {
            "$ref": "#/components/responses/Error405"
          },
          "429": {
            "$ref": "#/components/responses/Error429"
          },
          "500": {
            "$ref": "#/components/responses/Error500"
          },
          "501": {
            "$ref": "#/components/responses/Error501"
          },
          "503": {
            "$ref": "#/components/responses/Error503"
          }
        },
        "x-scope": "documents.read",
        "x-rate-class": "read",
        "x-error-codes": {
          "400": [
            "VALIDATION_FAILED"
          ],
          "401": [
            "UNAUTHENTICATED"
          ],
          "403": [
            "FORBIDDEN",
            "ACCESS_EXPIRED"
          ],
          "404": [
            "NOT_FOUND"
          ],
          "405": [
            "METHOD_NOT_ALLOWED"
          ],
          "429": [
            "RATE_LIMITED"
          ],
          "500": [
            "INTERNAL"
          ],
          "501": [
            "NOT_IMPLEMENTED"
          ],
          "503": [
            "SERVICE_UNAVAILABLE"
          ]
        },
        "x-narrowed": [
          "response"
        ]
      },
      "post": {
        "operationId": "documents.createRendition",
        "tags": [
          "documents"
        ],
        "summary": "Make a PDF copy of an issued document for the business’s own files (purpose `business_copy`, with an `Idempotency-Key`). When the answer’s `download` is null the copy is still being made: poll `documents.getRenditionDownload` (JOB_NOT_READY with Retry-After). When the document needs an allocation number, make the copy only once `allocation.number` is set: a copy made before prints no number. A key never gets the original.",
        "description": "API key with the scope `documents.read` (the creator's current role must hold it too). A key's body is `PublicApiCreateRenditionRequest` (narrower than the app's). Heavy: at most 10 a minute per key, and among the 60 requests with an `Idempotency-Key` a key may make in a minute. The body is JSON (`Content-Type: application/json`) of at most 1 MiB.",
        "security": [
          {
            "apiKey": [
              "documents.read"
            ]
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "documentId",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PublicApiCreateRenditionRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/RenditionResult"
                    },
                    "requestId": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "ok",
                    "data",
                    "requestId"
                  ]
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error400"
          },
          "401": {
            "$ref": "#/components/responses/Error401"
          },
          "403": {
            "$ref": "#/components/responses/Error403"
          },
          "404": {
            "$ref": "#/components/responses/Error404"
          },
          "405": {
            "$ref": "#/components/responses/Error405"
          },
          "409": {
            "$ref": "#/components/responses/Error409"
          },
          "413": {
            "$ref": "#/components/responses/Error413"
          },
          "415": {
            "$ref": "#/components/responses/Error415"
          },
          "422": {
            "$ref": "#/components/responses/Error422"
          },
          "429": {
            "$ref": "#/components/responses/Error429"
          },
          "500": {
            "$ref": "#/components/responses/Error500"
          },
          "501": {
            "$ref": "#/components/responses/Error501"
          },
          "503": {
            "$ref": "#/components/responses/Error503"
          }
        },
        "x-scope": "documents.read",
        "x-rate-class": "heavy",
        "x-error-codes": {
          "400": [
            "VALIDATION_FAILED",
            "IDEMPOTENCY_KEY_REQUIRED"
          ],
          "401": [
            "UNAUTHENTICATED"
          ],
          "403": [
            "FORBIDDEN",
            "ACCESS_EXPIRED"
          ],
          "404": [
            "NOT_FOUND"
          ],
          "405": [
            "METHOD_NOT_ALLOWED"
          ],
          "409": [
            "IDEMPOTENCY_REQUEST_IN_PROGRESS"
          ],
          "413": [
            "PAYLOAD_TOO_LARGE"
          ],
          "415": [
            "UNSUPPORTED_MEDIA_TYPE"
          ],
          "422": [
            "IDEMPOTENCY_KEY_REUSED",
            "DOCUMENT_NOT_ISSUED"
          ],
          "429": [
            "RATE_LIMITED"
          ],
          "500": [
            "INTERNAL"
          ],
          "501": [
            "NOT_IMPLEMENTED"
          ],
          "503": [
            "SERVICE_UNAVAILABLE"
          ]
        },
        "x-narrowed": [
          "body"
        ]
      }
    },
    "/v1/businesses/{businessId}/documents/{documentId}/renditions/{renditionId}/download": {
      "get": {
        "operationId": "documents.getRenditionDownload",
        "tags": [
          "documents"
        ],
        "summary": "A fresh short-lived link to a business copy made on a request (by the key’s own `documents.createRendition` or a member’s): JOB_NOT_READY with Retry-After while the copy is still being made, CONFLICT when making it failed.",
        "description": "API key with the scope `documents.read` (the creator's current role must hold it too). Also needs `documents.send` — a permission no key holds — when the rendition is not a business copy made on a request: the original, a copy the system stored by itself, or an id no rendition of the document has. A key gets FORBIDDEN without details for any of them, not NOT_FOUND.",
        "security": [
          {
            "apiKey": [
              "documents.read"
            ]
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "documentId",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "renditionId",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/DownloadLink"
                    },
                    "requestId": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "ok",
                    "data",
                    "requestId"
                  ]
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error400"
          },
          "401": {
            "$ref": "#/components/responses/Error401"
          },
          "403": {
            "$ref": "#/components/responses/Error403"
          },
          "404": {
            "$ref": "#/components/responses/Error404"
          },
          "405": {
            "$ref": "#/components/responses/Error405"
          },
          "409": {
            "$ref": "#/components/responses/Error409"
          },
          "429": {
            "$ref": "#/components/responses/Error429"
          },
          "500": {
            "$ref": "#/components/responses/Error500"
          },
          "501": {
            "$ref": "#/components/responses/Error501"
          },
          "503": {
            "$ref": "#/components/responses/Error503"
          }
        },
        "x-scope": "documents.read",
        "x-rate-class": "read",
        "x-error-codes": {
          "400": [
            "VALIDATION_FAILED"
          ],
          "401": [
            "UNAUTHENTICATED"
          ],
          "403": [
            "FORBIDDEN",
            "ACCESS_EXPIRED"
          ],
          "404": [
            "NOT_FOUND"
          ],
          "405": [
            "METHOD_NOT_ALLOWED"
          ],
          "409": [
            "JOB_NOT_READY",
            "CONFLICT"
          ],
          "429": [
            "RATE_LIMITED"
          ],
          "500": [
            "INTERNAL"
          ],
          "501": [
            "NOT_IMPLEMENTED"
          ],
          "503": [
            "SERVICE_UNAVAILABLE"
          ]
        },
        "x-conditional-scope": {
          "scope": "documents.send",
          "when": "the rendition is not a business copy made on a request: the original, a copy the system stored by itself, or an id no rendition of the document has. A key gets FORBIDDEN without details for any of them, not NOT_FOUND",
          "heldByKeys": false
        }
      }
    },
    "/v1/businesses/{businessId}/documents/{documentId}/send-to-customer": {
      "post": {
        "operationId": "delivery.sendToCustomer",
        "tags": [
          "delivery"
        ],
        "summary": "Proposed — open only where the deployment opened sending by key; elsewhere every key gets FORBIDDEN `ROUTE_NOT_IN_PUBLIC_API`. Send an issued document by e-mail to the e-mail addresses the document itself names, never to an address the request names. The first e-mail to a recipient who has not agreed to receive computerized documents is a link; the document goes signed with the business’s digital signature, as a send from the app does, or as a link when the business does not sign. Needs the key option `sending`, `documents.read` and an `Idempotency-Key`; CONFLICT when the document names no e-mail address. The answer never carries the customer page’s link.",
        "description": "API key with the sending option (\"שליחה ללקוח\", `sending`; permission `documents.send`), which an owner or a partner creates with the API terms annex version `api-2026-11-05`, only where sending by key is open. The key must also hold `documents.read`. Needs an `Idempotency-Key`, so it counts among the 60 requests with an `Idempotency-Key` a key may make in a minute. The body is JSON (`Content-Type: application/json`) of at most 1 MiB.",
        "security": [
          {
            "apiKey": [
              "documents.send"
            ]
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "documentId",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SendToCustomerRequest"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/SendToCustomerResult"
                    },
                    "requestId": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "ok",
                    "data",
                    "requestId"
                  ]
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error400"
          },
          "401": {
            "$ref": "#/components/responses/Error401"
          },
          "403": {
            "$ref": "#/components/responses/Error403"
          },
          "404": {
            "$ref": "#/components/responses/Error404"
          },
          "405": {
            "$ref": "#/components/responses/Error405"
          },
          "409": {
            "$ref": "#/components/responses/Error409"
          },
          "413": {
            "$ref": "#/components/responses/Error413"
          },
          "415": {
            "$ref": "#/components/responses/Error415"
          },
          "422": {
            "$ref": "#/components/responses/Error422"
          },
          "429": {
            "$ref": "#/components/responses/Error429"
          },
          "500": {
            "$ref": "#/components/responses/Error500"
          },
          "501": {
            "$ref": "#/components/responses/Error501"
          },
          "503": {
            "$ref": "#/components/responses/Error503"
          }
        },
        "x-scope": "documents.send",
        "x-rate-class": "write",
        "x-error-codes": {
          "400": [
            "VALIDATION_FAILED",
            "IDEMPOTENCY_KEY_REQUIRED"
          ],
          "401": [
            "UNAUTHENTICATED"
          ],
          "403": [
            "FORBIDDEN",
            "ACCESS_EXPIRED",
            "DIGITAL_SENDING_DISABLED"
          ],
          "404": [
            "NOT_FOUND"
          ],
          "405": [
            "METHOD_NOT_ALLOWED"
          ],
          "409": [
            "BUSINESS_READ_ONLY",
            "IDEMPOTENCY_REQUEST_IN_PROGRESS",
            "ALLOCATION_PENDING",
            "ALLOCATION_DECISION_REQUIRED",
            "CONSENT_REVOKED",
            "RECIPIENT_SUPPRESSED",
            "CONFLICT"
          ],
          "413": [
            "PAYLOAD_TOO_LARGE"
          ],
          "415": [
            "UNSUPPORTED_MEDIA_TYPE"
          ],
          "422": [
            "IDEMPOTENCY_KEY_REUSED",
            "DOCUMENT_NOT_ISSUED",
            "DOCUMENT_TYPE_NOT_ALLOWED",
            "PAPER_DELIVERY_REQUIRED"
          ],
          "429": [
            "RATE_LIMITED",
            "SENDING_LIMIT_REACHED"
          ],
          "500": [
            "INTERNAL"
          ],
          "501": [
            "NOT_IMPLEMENTED"
          ],
          "503": [
            "SERVICE_UNAVAILABLE"
          ]
        },
        "x-sending": true
      }
    },
    "/v1/businesses/{businessId}/exchange-rates": {
      "get": {
        "operationId": "documents.getExchangeRate",
        "tags": [
          "documents"
        ],
        "summary": "The Bank of Israel representative rate that a foreign-currency document of a date is computed with.",
        "description": "API key with the scope `documents.read` (the creator's current role must hold it too).",
        "security": [
          {
            "apiKey": [
              "documents.read"
            ]
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "currency",
            "in": "query",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/CurrencyCode"
            }
          },
          {
            "name": "date",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/LocalDate"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "const": true
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "currency": {
                          "$ref": "#/components/schemas/CurrencyCode"
                        },
                        "requestedDate": {
                          "$ref": "#/components/schemas/LocalDate"
                        },
                        "rate": {
                          "anyOf": [
                            {
                              "$ref": "#/components/schemas/ExchangeRate"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "rateDate": {
                          "anyOf": [
                            {
                              "$ref": "#/components/schemas/LocalDate"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "source": {
                          "type": "string",
                          "const": "boi"
                        }
                      },
                      "required": [
                        "currency",
                        "requestedDate",
                        "rate",
                        "rateDate",
                        "source"
                      ]
                    },
                    "requestId": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "ok",
                    "data",
                    "requestId"
                  ]
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error400"
          },
          "401": {
            "$ref": "#/components/responses/Error401"
          },
          "403": {
            "$ref": "#/components/responses/Error403"
          },
          "404": {
            "$ref": "#/components/responses/Error404"
          },
          "405": {
            "$ref": "#/components/responses/Error405"
          },
          "429": {
            "$ref": "#/components/responses/Error429"
          },
          "500": {
            "$ref": "#/components/responses/Error500"
          },
          "501": {
            "$ref": "#/components/responses/Error501"
          },
          "503": {
            "$ref": "#/components/responses/Error503"
          }
        },
        "x-scope": "documents.read",
        "x-rate-class": "read",
        "x-error-codes": {
          "400": [
            "VALIDATION_FAILED"
          ],
          "401": [
            "UNAUTHENTICATED"
          ],
          "403": [
            "FORBIDDEN",
            "ACCESS_EXPIRED"
          ],
          "404": [
            "NOT_FOUND"
          ],
          "405": [
            "METHOD_NOT_ALLOWED"
          ],
          "429": [
            "RATE_LIMITED"
          ],
          "500": [
            "INTERNAL"
          ],
          "501": [
            "NOT_IMPLEMENTED"
          ],
          "503": [
            "SERVICE_UNAVAILABLE"
          ]
        }
      }
    },
    "/v1/businesses/{businessId}/expense-categories": {
      "get": {
        "operationId": "expenses.listCategories",
        "tags": [
          "expenses"
        ],
        "summary": "The expense categories, each with its default input class.",
        "description": "API key with the scope `expenses.read` (the creator's current role must hold it too).",
        "security": [
          {
            "apiKey": [
              "expenses.read"
            ]
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "const": true
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ExpenseCategoryDef"
                      }
                    },
                    "requestId": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "ok",
                    "data",
                    "requestId"
                  ]
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error400"
          },
          "401": {
            "$ref": "#/components/responses/Error401"
          },
          "403": {
            "$ref": "#/components/responses/Error403"
          },
          "404": {
            "$ref": "#/components/responses/Error404"
          },
          "405": {
            "$ref": "#/components/responses/Error405"
          },
          "429": {
            "$ref": "#/components/responses/Error429"
          },
          "500": {
            "$ref": "#/components/responses/Error500"
          },
          "501": {
            "$ref": "#/components/responses/Error501"
          },
          "503": {
            "$ref": "#/components/responses/Error503"
          }
        },
        "x-scope": "expenses.read",
        "x-rate-class": "read",
        "x-error-codes": {
          "400": [
            "VALIDATION_FAILED"
          ],
          "401": [
            "UNAUTHENTICATED"
          ],
          "403": [
            "FORBIDDEN",
            "ACCESS_EXPIRED"
          ],
          "404": [
            "NOT_FOUND"
          ],
          "405": [
            "METHOD_NOT_ALLOWED"
          ],
          "429": [
            "RATE_LIMITED"
          ],
          "500": [
            "INTERNAL"
          ],
          "501": [
            "NOT_IMPLEMENTED"
          ],
          "503": [
            "SERVICE_UNAVAILABLE"
          ]
        }
      }
    },
    "/v1/businesses/{businessId}/expenses": {
      "get": {
        "operationId": "expenses.list",
        "tags": [
          "expenses"
        ],
        "summary": "The expenses, filtered by date, kind, category, supplier, the supplier’s document number, the file and its signature check, source and how recorded.",
        "description": "API key with the scope `expenses.read` (the creator's current role must hold it too). A key's query is `PublicApiExpenseListQuery` (narrower than the app's). A key's answer is `PublicApiExpensePage`, narrower than the app's: what it does not hold never reaches a key.",
        "security": [
          {
            "apiKey": [
              "expenses.read"
            ]
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "from",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/LocalDate"
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/LocalDate"
            }
          },
          {
            "name": "kind",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/ExpenseKind"
            }
          },
          {
            "name": "category",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/ExpenseCategory"
            }
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 100
            }
          },
          {
            "name": "receivedAsFile",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "true",
                "false"
              ]
            }
          },
          {
            "name": "signature",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/ReceivedSignatureStatus"
            }
          },
          {
            "name": "supplierCode",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/CustomerCode"
            }
          },
          {
            "name": "supplierName",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 120
            }
          },
          {
            "name": "supplierVatNumber",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^\\d{9}$"
            }
          },
          {
            "name": "supplierDocumentNumber",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 20
            }
          },
          {
            "name": "attachmentSha256",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/Sha256Hex"
            }
          },
          {
            "name": "currency",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string",
                  "enum": [
                    "ILS",
                    "foreign"
                  ]
                },
                {
                  "$ref": "#/components/schemas/ExpenseFxCurrency"
                }
              ]
            }
          },
          {
            "name": "vatTreatment",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/ExpenseVatTreatment"
            }
          },
          {
            "name": "source",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "manual",
                "mail"
              ]
            }
          },
          {
            "name": "recordedHow",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "auto",
                "person"
              ]
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 512
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "default": 25,
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/PublicApiExpensePage"
                    },
                    "requestId": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "ok",
                    "data",
                    "requestId"
                  ]
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error400"
          },
          "401": {
            "$ref": "#/components/responses/Error401"
          },
          "403": {
            "$ref": "#/components/responses/Error403"
          },
          "404": {
            "$ref": "#/components/responses/Error404"
          },
          "405": {
            "$ref": "#/components/responses/Error405"
          },
          "429": {
            "$ref": "#/components/responses/Error429"
          },
          "500": {
            "$ref": "#/components/responses/Error500"
          },
          "501": {
            "$ref": "#/components/responses/Error501"
          },
          "503": {
            "$ref": "#/components/responses/Error503"
          }
        },
        "x-scope": "expenses.read",
        "x-rate-class": "read",
        "x-error-codes": {
          "400": [
            "VALIDATION_FAILED"
          ],
          "401": [
            "UNAUTHENTICATED"
          ],
          "403": [
            "FORBIDDEN",
            "ACCESS_EXPIRED"
          ],
          "404": [
            "NOT_FOUND"
          ],
          "405": [
            "METHOD_NOT_ALLOWED"
          ],
          "429": [
            "RATE_LIMITED"
          ],
          "500": [
            "INTERNAL"
          ],
          "501": [
            "NOT_IMPLEMENTED"
          ],
          "503": [
            "SERVICE_UNAVAILABLE"
          ]
        },
        "x-narrowed": [
          "query",
          "response"
        ]
      }
    },
    "/v1/businesses/{businessId}/expenses/{expenseId}": {
      "get": {
        "operationId": "expenses.get",
        "tags": [
          "expenses"
        ],
        "summary": "One expense.",
        "description": "API key with the scope `expenses.read` (the creator's current role must hold it too). A key's answer is `PublicApiExpense`, narrower than the app's: what it does not hold never reaches a key.",
        "security": [
          {
            "apiKey": [
              "expenses.read"
            ]
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "expenseId",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/PublicApiExpense"
                    },
                    "requestId": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "ok",
                    "data",
                    "requestId"
                  ]
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error400"
          },
          "401": {
            "$ref": "#/components/responses/Error401"
          },
          "403": {
            "$ref": "#/components/responses/Error403"
          },
          "404": {
            "$ref": "#/components/responses/Error404"
          },
          "405": {
            "$ref": "#/components/responses/Error405"
          },
          "429": {
            "$ref": "#/components/responses/Error429"
          },
          "500": {
            "$ref": "#/components/responses/Error500"
          },
          "501": {
            "$ref": "#/components/responses/Error501"
          },
          "503": {
            "$ref": "#/components/responses/Error503"
          }
        },
        "x-scope": "expenses.read",
        "x-rate-class": "read",
        "x-error-codes": {
          "400": [
            "VALIDATION_FAILED"
          ],
          "401": [
            "UNAUTHENTICATED"
          ],
          "403": [
            "FORBIDDEN",
            "ACCESS_EXPIRED"
          ],
          "404": [
            "NOT_FOUND"
          ],
          "405": [
            "METHOD_NOT_ALLOWED"
          ],
          "429": [
            "RATE_LIMITED"
          ],
          "500": [
            "INTERNAL"
          ],
          "501": [
            "NOT_IMPLEMENTED"
          ],
          "503": [
            "SERVICE_UNAVAILABLE"
          ]
        },
        "x-narrowed": [
          "response"
        ]
      }
    },
    "/v1/businesses/{businessId}/expenses/{expenseId}/attachments/{uploadId}/link": {
      "post": {
        "operationId": "expenses.getAttachmentLink",
        "tags": [
          "expenses"
        ],
        "summary": "A short-lived link (10 minutes) to open one file of an expense, exactly as stored.",
        "description": "API key with the scope `expenses.read` (the creator's current role must hold it too). A file that came from Gmail is refused to a key: FORBIDDEN with `details[].code` GMAIL_SOURCED_FILE (the apps open it).",
        "security": [
          {
            "apiKey": [
              "expenses.read"
            ]
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "expenseId",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "uploadId",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/DownloadLink"
                    },
                    "requestId": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "ok",
                    "data",
                    "requestId"
                  ]
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error400"
          },
          "401": {
            "$ref": "#/components/responses/Error401"
          },
          "403": {
            "$ref": "#/components/responses/Error403"
          },
          "404": {
            "$ref": "#/components/responses/Error404"
          },
          "405": {
            "$ref": "#/components/responses/Error405"
          },
          "429": {
            "$ref": "#/components/responses/Error429"
          },
          "500": {
            "$ref": "#/components/responses/Error500"
          },
          "501": {
            "$ref": "#/components/responses/Error501"
          },
          "503": {
            "$ref": "#/components/responses/Error503"
          }
        },
        "x-scope": "expenses.read",
        "x-rate-class": "read",
        "x-error-codes": {
          "400": [
            "VALIDATION_FAILED"
          ],
          "401": [
            "UNAUTHENTICATED"
          ],
          "403": [
            "FORBIDDEN",
            "ACCESS_EXPIRED"
          ],
          "404": [
            "NOT_FOUND"
          ],
          "405": [
            "METHOD_NOT_ALLOWED"
          ],
          "429": [
            "RATE_LIMITED"
          ],
          "500": [
            "INTERNAL"
          ],
          "501": [
            "NOT_IMPLEMENTED"
          ],
          "503": [
            "SERVICE_UNAVAILABLE"
          ]
        }
      }
    },
    "/v1/businesses/{businessId}/items": {
      "get": {
        "operationId": "items.list",
        "tags": [
          "items"
        ],
        "summary": "Search the catalogue items.",
        "description": "API key with the scope `items.read` (the creator's current role must hold it too).",
        "security": [
          {
            "apiKey": [
              "items.read"
            ]
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 100
            }
          },
          {
            "name": "archived",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "true",
                "false"
              ]
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 512
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "default": 25,
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "const": true
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "items": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/Item"
                          }
                        },
                        "nextCursor": {
                          "anyOf": [
                            {
                              "type": "string",
                              "maxLength": 512
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      },
                      "required": [
                        "items",
                        "nextCursor"
                      ]
                    },
                    "requestId": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "ok",
                    "data",
                    "requestId"
                  ]
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error400"
          },
          "401": {
            "$ref": "#/components/responses/Error401"
          },
          "403": {
            "$ref": "#/components/responses/Error403"
          },
          "404": {
            "$ref": "#/components/responses/Error404"
          },
          "405": {
            "$ref": "#/components/responses/Error405"
          },
          "429": {
            "$ref": "#/components/responses/Error429"
          },
          "500": {
            "$ref": "#/components/responses/Error500"
          },
          "501": {
            "$ref": "#/components/responses/Error501"
          },
          "503": {
            "$ref": "#/components/responses/Error503"
          }
        },
        "x-scope": "items.read",
        "x-rate-class": "read",
        "x-error-codes": {
          "400": [
            "VALIDATION_FAILED"
          ],
          "401": [
            "UNAUTHENTICATED"
          ],
          "403": [
            "FORBIDDEN",
            "ACCESS_EXPIRED"
          ],
          "404": [
            "NOT_FOUND"
          ],
          "405": [
            "METHOD_NOT_ALLOWED"
          ],
          "429": [
            "RATE_LIMITED"
          ],
          "500": [
            "INTERNAL"
          ],
          "501": [
            "NOT_IMPLEMENTED"
          ],
          "503": [
            "SERVICE_UNAVAILABLE"
          ]
        }
      },
      "post": {
        "operationId": "items.create",
        "tags": [
          "items"
        ],
        "summary": "Add a catalogue item (its code: at most 20 characters, unique in the business).",
        "description": "API key with the scope `items.write` (the creator's current role must hold it too). Needs an `Idempotency-Key`, so it counts among the 60 requests with an `Idempotency-Key` a key may make in a minute. The body is JSON (`Content-Type: application/json`) of at most 1 MiB.",
        "security": [
          {
            "apiKey": [
              "items.write"
            ]
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ItemInput"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/Item"
                    },
                    "requestId": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "ok",
                    "data",
                    "requestId"
                  ]
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error400"
          },
          "401": {
            "$ref": "#/components/responses/Error401"
          },
          "403": {
            "$ref": "#/components/responses/Error403"
          },
          "404": {
            "$ref": "#/components/responses/Error404"
          },
          "405": {
            "$ref": "#/components/responses/Error405"
          },
          "409": {
            "$ref": "#/components/responses/Error409"
          },
          "413": {
            "$ref": "#/components/responses/Error413"
          },
          "415": {
            "$ref": "#/components/responses/Error415"
          },
          "422": {
            "$ref": "#/components/responses/Error422"
          },
          "429": {
            "$ref": "#/components/responses/Error429"
          },
          "500": {
            "$ref": "#/components/responses/Error500"
          },
          "501": {
            "$ref": "#/components/responses/Error501"
          },
          "503": {
            "$ref": "#/components/responses/Error503"
          }
        },
        "x-scope": "items.write",
        "x-rate-class": "write",
        "x-error-codes": {
          "400": [
            "VALIDATION_FAILED",
            "IDEMPOTENCY_KEY_REQUIRED"
          ],
          "401": [
            "UNAUTHENTICATED"
          ],
          "403": [
            "FORBIDDEN",
            "ACCESS_EXPIRED"
          ],
          "404": [
            "NOT_FOUND"
          ],
          "405": [
            "METHOD_NOT_ALLOWED"
          ],
          "409": [
            "BUSINESS_READ_ONLY",
            "IDEMPOTENCY_REQUEST_IN_PROGRESS",
            "CONFLICT"
          ],
          "413": [
            "PAYLOAD_TOO_LARGE"
          ],
          "415": [
            "UNSUPPORTED_MEDIA_TYPE"
          ],
          "422": [
            "IDEMPOTENCY_KEY_REUSED"
          ],
          "429": [
            "RATE_LIMITED"
          ],
          "500": [
            "INTERNAL"
          ],
          "501": [
            "NOT_IMPLEMENTED"
          ],
          "503": [
            "SERVICE_UNAVAILABLE"
          ]
        }
      }
    },
    "/v1/businesses/{businessId}/items/{itemId}": {
      "get": {
        "operationId": "items.get",
        "tags": [
          "items"
        ],
        "summary": "One catalogue item.",
        "description": "API key with the scope `items.read` (the creator's current role must hold it too).",
        "security": [
          {
            "apiKey": [
              "items.read"
            ]
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "itemId",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/Item"
                    },
                    "requestId": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "ok",
                    "data",
                    "requestId"
                  ]
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error400"
          },
          "401": {
            "$ref": "#/components/responses/Error401"
          },
          "403": {
            "$ref": "#/components/responses/Error403"
          },
          "404": {
            "$ref": "#/components/responses/Error404"
          },
          "405": {
            "$ref": "#/components/responses/Error405"
          },
          "429": {
            "$ref": "#/components/responses/Error429"
          },
          "500": {
            "$ref": "#/components/responses/Error500"
          },
          "501": {
            "$ref": "#/components/responses/Error501"
          },
          "503": {
            "$ref": "#/components/responses/Error503"
          }
        },
        "x-scope": "items.read",
        "x-rate-class": "read",
        "x-error-codes": {
          "400": [
            "VALIDATION_FAILED"
          ],
          "401": [
            "UNAUTHENTICATED"
          ],
          "403": [
            "FORBIDDEN",
            "ACCESS_EXPIRED"
          ],
          "404": [
            "NOT_FOUND"
          ],
          "405": [
            "METHOD_NOT_ALLOWED"
          ],
          "429": [
            "RATE_LIMITED"
          ],
          "500": [
            "INTERNAL"
          ],
          "501": [
            "NOT_IMPLEMENTED"
          ],
          "503": [
            "SERVICE_UNAVAILABLE"
          ]
        }
      },
      "put": {
        "operationId": "items.update",
        "tags": [
          "items"
        ],
        "summary": "Replace a catalogue item. Issued documents keep their lines as they were issued.",
        "description": "API key with the scope `items.write` (the creator's current role must hold it too). Needs an `Idempotency-Key`, so it counts among the 60 requests with an `Idempotency-Key` a key may make in a minute. The body is JSON (`Content-Type: application/json`) of at most 1 MiB.",
        "security": [
          {
            "apiKey": [
              "items.write"
            ]
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "itemId",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ItemInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/Item"
                    },
                    "requestId": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "ok",
                    "data",
                    "requestId"
                  ]
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error400"
          },
          "401": {
            "$ref": "#/components/responses/Error401"
          },
          "403": {
            "$ref": "#/components/responses/Error403"
          },
          "404": {
            "$ref": "#/components/responses/Error404"
          },
          "405": {
            "$ref": "#/components/responses/Error405"
          },
          "409": {
            "$ref": "#/components/responses/Error409"
          },
          "413": {
            "$ref": "#/components/responses/Error413"
          },
          "415": {
            "$ref": "#/components/responses/Error415"
          },
          "422": {
            "$ref": "#/components/responses/Error422"
          },
          "429": {
            "$ref": "#/components/responses/Error429"
          },
          "500": {
            "$ref": "#/components/responses/Error500"
          },
          "501": {
            "$ref": "#/components/responses/Error501"
          },
          "503": {
            "$ref": "#/components/responses/Error503"
          }
        },
        "x-scope": "items.write",
        "x-rate-class": "write",
        "x-error-codes": {
          "400": [
            "VALIDATION_FAILED",
            "IDEMPOTENCY_KEY_REQUIRED"
          ],
          "401": [
            "UNAUTHENTICATED"
          ],
          "403": [
            "FORBIDDEN",
            "ACCESS_EXPIRED"
          ],
          "404": [
            "NOT_FOUND"
          ],
          "405": [
            "METHOD_NOT_ALLOWED"
          ],
          "409": [
            "BUSINESS_READ_ONLY",
            "IDEMPOTENCY_REQUEST_IN_PROGRESS",
            "CONFLICT"
          ],
          "413": [
            "PAYLOAD_TOO_LARGE"
          ],
          "415": [
            "UNSUPPORTED_MEDIA_TYPE"
          ],
          "422": [
            "IDEMPOTENCY_KEY_REUSED"
          ],
          "429": [
            "RATE_LIMITED"
          ],
          "500": [
            "INTERNAL"
          ],
          "501": [
            "NOT_IMPLEMENTED"
          ],
          "503": [
            "SERVICE_UNAVAILABLE"
          ]
        }
      }
    },
    "/v1/businesses/{businessId}/items/{itemId}/archive": {
      "post": {
        "operationId": "items.archive",
        "tags": [
          "items"
        ],
        "summary": "Archive a catalogue item: hidden when choosing an item for a new document.",
        "description": "API key with the scope `items.write` (the creator's current role must hold it too). Needs an `Idempotency-Key`, so it counts among the 60 requests with an `Idempotency-Key` a key may make in a minute.",
        "security": [
          {
            "apiKey": [
              "items.write"
            ]
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "itemId",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/Item"
                    },
                    "requestId": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "ok",
                    "data",
                    "requestId"
                  ]
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error400"
          },
          "401": {
            "$ref": "#/components/responses/Error401"
          },
          "403": {
            "$ref": "#/components/responses/Error403"
          },
          "404": {
            "$ref": "#/components/responses/Error404"
          },
          "405": {
            "$ref": "#/components/responses/Error405"
          },
          "409": {
            "$ref": "#/components/responses/Error409"
          },
          "422": {
            "$ref": "#/components/responses/Error422"
          },
          "429": {
            "$ref": "#/components/responses/Error429"
          },
          "500": {
            "$ref": "#/components/responses/Error500"
          },
          "501": {
            "$ref": "#/components/responses/Error501"
          },
          "503": {
            "$ref": "#/components/responses/Error503"
          }
        },
        "x-scope": "items.write",
        "x-rate-class": "write",
        "x-error-codes": {
          "400": [
            "VALIDATION_FAILED",
            "IDEMPOTENCY_KEY_REQUIRED"
          ],
          "401": [
            "UNAUTHENTICATED"
          ],
          "403": [
            "FORBIDDEN",
            "ACCESS_EXPIRED"
          ],
          "404": [
            "NOT_FOUND"
          ],
          "405": [
            "METHOD_NOT_ALLOWED"
          ],
          "409": [
            "BUSINESS_READ_ONLY",
            "IDEMPOTENCY_REQUEST_IN_PROGRESS"
          ],
          "422": [
            "IDEMPOTENCY_KEY_REUSED"
          ],
          "429": [
            "RATE_LIMITED"
          ],
          "500": [
            "INTERNAL"
          ],
          "501": [
            "NOT_IMPLEMENTED"
          ],
          "503": [
            "SERVICE_UNAVAILABLE"
          ]
        }
      }
    },
    "/v1/businesses/{businessId}/items/{itemId}/unarchive": {
      "post": {
        "operationId": "items.unarchive",
        "tags": [
          "items"
        ],
        "summary": "Bring an archived catalogue item back.",
        "description": "API key with the scope `items.write` (the creator's current role must hold it too). Needs an `Idempotency-Key`, so it counts among the 60 requests with an `Idempotency-Key` a key may make in a minute.",
        "security": [
          {
            "apiKey": [
              "items.write"
            ]
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "itemId",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/Item"
                    },
                    "requestId": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "ok",
                    "data",
                    "requestId"
                  ]
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error400"
          },
          "401": {
            "$ref": "#/components/responses/Error401"
          },
          "403": {
            "$ref": "#/components/responses/Error403"
          },
          "404": {
            "$ref": "#/components/responses/Error404"
          },
          "405": {
            "$ref": "#/components/responses/Error405"
          },
          "409": {
            "$ref": "#/components/responses/Error409"
          },
          "422": {
            "$ref": "#/components/responses/Error422"
          },
          "429": {
            "$ref": "#/components/responses/Error429"
          },
          "500": {
            "$ref": "#/components/responses/Error500"
          },
          "501": {
            "$ref": "#/components/responses/Error501"
          },
          "503": {
            "$ref": "#/components/responses/Error503"
          }
        },
        "x-scope": "items.write",
        "x-rate-class": "write",
        "x-error-codes": {
          "400": [
            "VALIDATION_FAILED",
            "IDEMPOTENCY_KEY_REQUIRED"
          ],
          "401": [
            "UNAUTHENTICATED"
          ],
          "403": [
            "FORBIDDEN",
            "ACCESS_EXPIRED"
          ],
          "404": [
            "NOT_FOUND"
          ],
          "405": [
            "METHOD_NOT_ALLOWED"
          ],
          "409": [
            "BUSINESS_READ_ONLY",
            "IDEMPOTENCY_REQUEST_IN_PROGRESS"
          ],
          "422": [
            "IDEMPOTENCY_KEY_REUSED"
          ],
          "429": [
            "RATE_LIMITED"
          ],
          "500": [
            "INTERNAL"
          ],
          "501": [
            "NOT_IMPLEMENTED"
          ],
          "503": [
            "SERVICE_UNAVAILABLE"
          ]
        }
      }
    },
    "/v1/businesses/{businessId}/report-exports": {
      "get": {
        "operationId": "reports.listExports",
        "tags": [
          "reports"
        ],
        "summary": "The recent report exports.",
        "description": "API key with the scope `reports.export` (the creator's current role must hold it too). A key's answer is a narrower schema, narrower than the app's: what it does not hold never reaches a key. A member’s export of a kind a key never exports, selected by an allocation state or searched by more than 9 digits is left out, and answers NOT_FOUND on `reports.getExport` and `reports.downloadExport`. So are a member’s PCN874 file and a member’s list of the invoices and inputs of a VAT period that began in another system: each names suppliers one by one. A key’s own `pcn874` export only counts and ends `failed`, with the counts in `summary`.",
        "security": [
          {
            "apiKey": [
              "reports.export"
            ]
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "const": true
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/PublicApiReportExport"
                      }
                    },
                    "requestId": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "ok",
                    "data",
                    "requestId"
                  ]
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error400"
          },
          "401": {
            "$ref": "#/components/responses/Error401"
          },
          "403": {
            "$ref": "#/components/responses/Error403"
          },
          "404": {
            "$ref": "#/components/responses/Error404"
          },
          "405": {
            "$ref": "#/components/responses/Error405"
          },
          "429": {
            "$ref": "#/components/responses/Error429"
          },
          "500": {
            "$ref": "#/components/responses/Error500"
          },
          "501": {
            "$ref": "#/components/responses/Error501"
          },
          "503": {
            "$ref": "#/components/responses/Error503"
          }
        },
        "x-scope": "reports.export",
        "x-rate-class": "read",
        "x-error-codes": {
          "400": [
            "VALIDATION_FAILED"
          ],
          "401": [
            "UNAUTHENTICATED"
          ],
          "403": [
            "FORBIDDEN",
            "ACCESS_EXPIRED"
          ],
          "404": [
            "NOT_FOUND"
          ],
          "405": [
            "METHOD_NOT_ALLOWED"
          ],
          "429": [
            "RATE_LIMITED"
          ],
          "500": [
            "INTERNAL"
          ],
          "501": [
            "NOT_IMPLEMENTED"
          ],
          "503": [
            "SERVICE_UNAVAILABLE"
          ]
        },
        "x-narrowed": [
          "response"
        ]
      },
      "post": {
        "operationId": "reports.createExport",
        "tags": [
          "reports"
        ],
        "summary": "Export a report — PDF, CSV, Excel, PCN874, or a ZIP of documents — as a job.",
        "description": "API key with the scope `reports.export` (the creator's current role must hold it too). A key's body is `PublicApiCreateReportExportRequest` (narrower than the app's). A key's answer is `PublicApiReportExport`, narrower than the app's: what it does not hold never reaches a key. A `filters.q` of digits only has at most 9 of them (an allocation number as printed); a longer one answers VALIDATION_FAILED. Heavy: at most 10 a minute per key, and among the 60 requests with an `Idempotency-Key` a key may make in a minute. Refused (RATE_LIMITED) while 3 exports of the business wait or run. The body is JSON (`Content-Type: application/json`) of at most 1 MiB.",
        "security": [
          {
            "apiKey": [
              "reports.export"
            ]
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PublicApiCreateReportExportRequest"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/PublicApiReportExport"
                    },
                    "requestId": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "ok",
                    "data",
                    "requestId"
                  ]
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error400"
          },
          "401": {
            "$ref": "#/components/responses/Error401"
          },
          "403": {
            "$ref": "#/components/responses/Error403"
          },
          "404": {
            "$ref": "#/components/responses/Error404"
          },
          "405": {
            "$ref": "#/components/responses/Error405"
          },
          "409": {
            "$ref": "#/components/responses/Error409"
          },
          "413": {
            "$ref": "#/components/responses/Error413"
          },
          "415": {
            "$ref": "#/components/responses/Error415"
          },
          "422": {
            "$ref": "#/components/responses/Error422"
          },
          "429": {
            "$ref": "#/components/responses/Error429"
          },
          "500": {
            "$ref": "#/components/responses/Error500"
          },
          "501": {
            "$ref": "#/components/responses/Error501"
          },
          "503": {
            "$ref": "#/components/responses/Error503"
          }
        },
        "x-scope": "reports.export",
        "x-rate-class": "heavy",
        "x-error-codes": {
          "400": [
            "VALIDATION_FAILED",
            "IDEMPOTENCY_KEY_REQUIRED"
          ],
          "401": [
            "UNAUTHENTICATED"
          ],
          "403": [
            "FORBIDDEN",
            "ACCESS_EXPIRED"
          ],
          "404": [
            "NOT_FOUND"
          ],
          "405": [
            "METHOD_NOT_ALLOWED"
          ],
          "409": [
            "IDEMPOTENCY_REQUEST_IN_PROGRESS"
          ],
          "413": [
            "PAYLOAD_TOO_LARGE"
          ],
          "415": [
            "UNSUPPORTED_MEDIA_TYPE"
          ],
          "422": [
            "IDEMPOTENCY_KEY_REUSED"
          ],
          "429": [
            "RATE_LIMITED"
          ],
          "500": [
            "INTERNAL"
          ],
          "501": [
            "NOT_IMPLEMENTED"
          ],
          "503": [
            "SERVICE_UNAVAILABLE"
          ]
        },
        "x-narrowed": [
          "body",
          "response"
        ]
      }
    },
    "/v1/businesses/{businessId}/report-exports/{exportId}": {
      "get": {
        "operationId": "reports.getExport",
        "tags": [
          "reports"
        ],
        "summary": "The state of one export job.",
        "description": "API key with the scope `reports.export` (the creator's current role must hold it too). A key's answer is `PublicApiReportExport`, narrower than the app's: what it does not hold never reaches a key.",
        "security": [
          {
            "apiKey": [
              "reports.export"
            ]
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "exportId",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/PublicApiReportExport"
                    },
                    "requestId": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "ok",
                    "data",
                    "requestId"
                  ]
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error400"
          },
          "401": {
            "$ref": "#/components/responses/Error401"
          },
          "403": {
            "$ref": "#/components/responses/Error403"
          },
          "404": {
            "$ref": "#/components/responses/Error404"
          },
          "405": {
            "$ref": "#/components/responses/Error405"
          },
          "429": {
            "$ref": "#/components/responses/Error429"
          },
          "500": {
            "$ref": "#/components/responses/Error500"
          },
          "501": {
            "$ref": "#/components/responses/Error501"
          },
          "503": {
            "$ref": "#/components/responses/Error503"
          }
        },
        "x-scope": "reports.export",
        "x-rate-class": "read",
        "x-error-codes": {
          "400": [
            "VALIDATION_FAILED"
          ],
          "401": [
            "UNAUTHENTICATED"
          ],
          "403": [
            "FORBIDDEN",
            "ACCESS_EXPIRED"
          ],
          "404": [
            "NOT_FOUND"
          ],
          "405": [
            "METHOD_NOT_ALLOWED"
          ],
          "429": [
            "RATE_LIMITED"
          ],
          "500": [
            "INTERNAL"
          ],
          "501": [
            "NOT_IMPLEMENTED"
          ],
          "503": [
            "SERVICE_UNAVAILABLE"
          ]
        },
        "x-narrowed": [
          "response"
        ]
      }
    },
    "/v1/businesses/{businessId}/report-exports/{exportId}/download": {
      "post": {
        "operationId": "reports.downloadExport",
        "tags": [
          "reports"
        ],
        "summary": "A short-lived link to the exported file.",
        "description": "API key with the scope `reports.export` (the creator's current role must hold it too).",
        "security": [
          {
            "apiKey": [
              "reports.export"
            ]
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "exportId",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/DownloadLink"
                    },
                    "requestId": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "ok",
                    "data",
                    "requestId"
                  ]
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error400"
          },
          "401": {
            "$ref": "#/components/responses/Error401"
          },
          "403": {
            "$ref": "#/components/responses/Error403"
          },
          "404": {
            "$ref": "#/components/responses/Error404"
          },
          "405": {
            "$ref": "#/components/responses/Error405"
          },
          "409": {
            "$ref": "#/components/responses/Error409"
          },
          "429": {
            "$ref": "#/components/responses/Error429"
          },
          "500": {
            "$ref": "#/components/responses/Error500"
          },
          "501": {
            "$ref": "#/components/responses/Error501"
          },
          "503": {
            "$ref": "#/components/responses/Error503"
          }
        },
        "x-scope": "reports.export",
        "x-rate-class": "read",
        "x-error-codes": {
          "400": [
            "VALIDATION_FAILED"
          ],
          "401": [
            "UNAUTHENTICATED"
          ],
          "403": [
            "FORBIDDEN",
            "ACCESS_EXPIRED"
          ],
          "404": [
            "NOT_FOUND"
          ],
          "405": [
            "METHOD_NOT_ALLOWED"
          ],
          "409": [
            "JOB_NOT_READY"
          ],
          "429": [
            "RATE_LIMITED"
          ],
          "500": [
            "INTERNAL"
          ],
          "501": [
            "NOT_IMPLEMENTED"
          ],
          "503": [
            "SERVICE_UNAVAILABLE"
          ]
        }
      }
    },
    "/v1/businesses/{businessId}/reports/advances": {
      "get": {
        "operationId": "reports.advances",
        "tags": [
          "reports"
        ],
        "summary": "Turnover and the income-tax advance of a period.",
        "description": "API key with the scope `reports.read` (the creator's current role must hold it too). A key's answer is `AdvancesReport`, narrower than the app's: what it does not hold never reaches a key. Heavy: at most 10 a minute per key.",
        "security": [
          {
            "apiKey": [
              "reports.read"
            ]
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "from",
            "in": "query",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/LocalDate"
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/LocalDate"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/AdvancesReport"
                    },
                    "requestId": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "ok",
                    "data",
                    "requestId"
                  ]
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error400"
          },
          "401": {
            "$ref": "#/components/responses/Error401"
          },
          "403": {
            "$ref": "#/components/responses/Error403"
          },
          "404": {
            "$ref": "#/components/responses/Error404"
          },
          "405": {
            "$ref": "#/components/responses/Error405"
          },
          "429": {
            "$ref": "#/components/responses/Error429"
          },
          "500": {
            "$ref": "#/components/responses/Error500"
          },
          "501": {
            "$ref": "#/components/responses/Error501"
          },
          "503": {
            "$ref": "#/components/responses/Error503"
          }
        },
        "x-scope": "reports.read",
        "x-rate-class": "heavy",
        "x-error-codes": {
          "400": [
            "VALIDATION_FAILED"
          ],
          "401": [
            "UNAUTHENTICATED"
          ],
          "403": [
            "FORBIDDEN",
            "ACCESS_EXPIRED"
          ],
          "404": [
            "NOT_FOUND"
          ],
          "405": [
            "METHOD_NOT_ALLOWED"
          ],
          "429": [
            "RATE_LIMITED"
          ],
          "500": [
            "INTERNAL"
          ],
          "501": [
            "NOT_IMPLEMENTED"
          ],
          "503": [
            "SERVICE_UNAVAILABLE"
          ]
        },
        "x-narrowed": [
          "response"
        ]
      }
    },
    "/v1/businesses/{businessId}/reports/expenses": {
      "get": {
        "operationId": "reports.expenses",
        "tags": [
          "reports"
        ],
        "summary": "Expenses by category and month.",
        "description": "API key with the scope `reports.read` (the creator's current role must hold it too). Heavy: at most 10 a minute per key.",
        "security": [
          {
            "apiKey": [
              "reports.read"
            ]
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "from",
            "in": "query",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/LocalDate"
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/LocalDate"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/ExpensesReport"
                    },
                    "requestId": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "ok",
                    "data",
                    "requestId"
                  ]
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error400"
          },
          "401": {
            "$ref": "#/components/responses/Error401"
          },
          "403": {
            "$ref": "#/components/responses/Error403"
          },
          "404": {
            "$ref": "#/components/responses/Error404"
          },
          "405": {
            "$ref": "#/components/responses/Error405"
          },
          "429": {
            "$ref": "#/components/responses/Error429"
          },
          "500": {
            "$ref": "#/components/responses/Error500"
          },
          "501": {
            "$ref": "#/components/responses/Error501"
          },
          "503": {
            "$ref": "#/components/responses/Error503"
          }
        },
        "x-scope": "reports.read",
        "x-rate-class": "heavy",
        "x-error-codes": {
          "400": [
            "VALIDATION_FAILED"
          ],
          "401": [
            "UNAUTHENTICATED"
          ],
          "403": [
            "FORBIDDEN",
            "ACCESS_EXPIRED"
          ],
          "404": [
            "NOT_FOUND"
          ],
          "405": [
            "METHOD_NOT_ALLOWED"
          ],
          "429": [
            "RATE_LIMITED"
          ],
          "500": [
            "INTERNAL"
          ],
          "501": [
            "NOT_IMPLEMENTED"
          ],
          "503": [
            "SERVICE_UNAVAILABLE"
          ]
        }
      }
    },
    "/v1/businesses/{businessId}/reports/income": {
      "get": {
        "operationId": "reports.income",
        "tags": [
          "reports"
        ],
        "summary": "Income by month and document type; optionally of one customer and / or one document type.",
        "description": "API key with the scope `reports.read` (the creator's current role must hold it too). A key's answer is `IncomeReport`, narrower than the app's: what it does not hold never reaches a key. Heavy: at most 10 a minute per key.",
        "security": [
          {
            "apiKey": [
              "reports.read"
            ]
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "from",
            "in": "query",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/LocalDate"
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/LocalDate"
            }
          },
          {
            "name": "customerId",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "documentType",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/DocumentType"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/IncomeReport"
                    },
                    "requestId": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "ok",
                    "data",
                    "requestId"
                  ]
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error400"
          },
          "401": {
            "$ref": "#/components/responses/Error401"
          },
          "403": {
            "$ref": "#/components/responses/Error403"
          },
          "404": {
            "$ref": "#/components/responses/Error404"
          },
          "405": {
            "$ref": "#/components/responses/Error405"
          },
          "429": {
            "$ref": "#/components/responses/Error429"
          },
          "500": {
            "$ref": "#/components/responses/Error500"
          },
          "501": {
            "$ref": "#/components/responses/Error501"
          },
          "503": {
            "$ref": "#/components/responses/Error503"
          }
        },
        "x-scope": "reports.read",
        "x-rate-class": "heavy",
        "x-error-codes": {
          "400": [
            "VALIDATION_FAILED"
          ],
          "401": [
            "UNAUTHENTICATED"
          ],
          "403": [
            "FORBIDDEN",
            "ACCESS_EXPIRED"
          ],
          "404": [
            "NOT_FOUND"
          ],
          "405": [
            "METHOD_NOT_ALLOWED"
          ],
          "429": [
            "RATE_LIMITED"
          ],
          "500": [
            "INTERNAL"
          ],
          "501": [
            "NOT_IMPLEMENTED"
          ],
          "503": [
            "SERVICE_UNAVAILABLE"
          ]
        },
        "x-narrowed": [
          "response"
        ]
      }
    },
    "/v1/businesses/{businessId}/reports/open-debts": {
      "get": {
        "operationId": "reports.openDebts",
        "tags": [
          "reports"
        ],
        "summary": "Customer balances from invoices, credit notes and receipts.",
        "description": "API key with the scope `reports.read` (the creator's current role must hold it too). Heavy: at most 10 a minute per key.",
        "security": [
          {
            "apiKey": [
              "reports.read"
            ]
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "asOf",
            "in": "query",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/LocalDate"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/OpenDebtsReport"
                    },
                    "requestId": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "ok",
                    "data",
                    "requestId"
                  ]
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error400"
          },
          "401": {
            "$ref": "#/components/responses/Error401"
          },
          "403": {
            "$ref": "#/components/responses/Error403"
          },
          "404": {
            "$ref": "#/components/responses/Error404"
          },
          "405": {
            "$ref": "#/components/responses/Error405"
          },
          "429": {
            "$ref": "#/components/responses/Error429"
          },
          "500": {
            "$ref": "#/components/responses/Error500"
          },
          "501": {
            "$ref": "#/components/responses/Error501"
          },
          "503": {
            "$ref": "#/components/responses/Error503"
          }
        },
        "x-scope": "reports.read",
        "x-rate-class": "heavy",
        "x-error-codes": {
          "400": [
            "VALIDATION_FAILED"
          ],
          "401": [
            "UNAUTHENTICATED"
          ],
          "403": [
            "FORBIDDEN",
            "ACCESS_EXPIRED"
          ],
          "404": [
            "NOT_FOUND"
          ],
          "405": [
            "METHOD_NOT_ALLOWED"
          ],
          "429": [
            "RATE_LIMITED"
          ],
          "500": [
            "INTERNAL"
          ],
          "501": [
            "NOT_IMPLEMENTED"
          ],
          "503": [
            "SERVICE_UNAVAILABLE"
          ]
        }
      }
    },
    "/v1/businesses/{businessId}/reports/profit-and-loss": {
      "get": {
        "operationId": "reports.profitAndLoss",
        "tags": [
          "reports"
        ],
        "summary": "Management profit and loss: income minus expenses.",
        "description": "API key with the scope `reports.read` (the creator's current role must hold it too). A key's answer is `ProfitAndLossReport`, narrower than the app's: what it does not hold never reaches a key. Heavy: at most 10 a minute per key.",
        "security": [
          {
            "apiKey": [
              "reports.read"
            ]
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "from",
            "in": "query",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/LocalDate"
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/LocalDate"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/ProfitAndLossReport"
                    },
                    "requestId": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "ok",
                    "data",
                    "requestId"
                  ]
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error400"
          },
          "401": {
            "$ref": "#/components/responses/Error401"
          },
          "403": {
            "$ref": "#/components/responses/Error403"
          },
          "404": {
            "$ref": "#/components/responses/Error404"
          },
          "405": {
            "$ref": "#/components/responses/Error405"
          },
          "429": {
            "$ref": "#/components/responses/Error429"
          },
          "500": {
            "$ref": "#/components/responses/Error500"
          },
          "501": {
            "$ref": "#/components/responses/Error501"
          },
          "503": {
            "$ref": "#/components/responses/Error503"
          }
        },
        "x-scope": "reports.read",
        "x-rate-class": "heavy",
        "x-error-codes": {
          "400": [
            "VALIDATION_FAILED"
          ],
          "401": [
            "UNAUTHENTICATED"
          ],
          "403": [
            "FORBIDDEN",
            "ACCESS_EXPIRED"
          ],
          "404": [
            "NOT_FOUND"
          ],
          "405": [
            "METHOD_NOT_ALLOWED"
          ],
          "429": [
            "RATE_LIMITED"
          ],
          "500": [
            "INTERNAL"
          ],
          "501": [
            "NOT_IMPLEMENTED"
          ],
          "503": [
            "SERVICE_UNAVAILABLE"
          ]
        },
        "x-narrowed": [
          "response"
        ]
      }
    },
    "/v1/businesses/{businessId}/reports/receipts-book": {
      "get": {
        "operationId": "reports.receiptsBook",
        "tags": [
          "reports"
        ],
        "summary": "The receipts book: every receipt and tax invoice / receipt, with its payment methods.",
        "description": "API key with the scope `reports.read` (the creator's current role must hold it too). Heavy: at most 10 a minute per key.",
        "security": [
          {
            "apiKey": [
              "reports.read"
            ]
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "from",
            "in": "query",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/LocalDate"
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/LocalDate"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/ReceiptsBookReport"
                    },
                    "requestId": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "ok",
                    "data",
                    "requestId"
                  ]
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error400"
          },
          "401": {
            "$ref": "#/components/responses/Error401"
          },
          "403": {
            "$ref": "#/components/responses/Error403"
          },
          "404": {
            "$ref": "#/components/responses/Error404"
          },
          "405": {
            "$ref": "#/components/responses/Error405"
          },
          "429": {
            "$ref": "#/components/responses/Error429"
          },
          "500": {
            "$ref": "#/components/responses/Error500"
          },
          "501": {
            "$ref": "#/components/responses/Error501"
          },
          "503": {
            "$ref": "#/components/responses/Error503"
          }
        },
        "x-scope": "reports.read",
        "x-rate-class": "heavy",
        "x-error-codes": {
          "400": [
            "VALIDATION_FAILED"
          ],
          "401": [
            "UNAUTHENTICATED"
          ],
          "403": [
            "FORBIDDEN",
            "ACCESS_EXPIRED"
          ],
          "404": [
            "NOT_FOUND"
          ],
          "405": [
            "METHOD_NOT_ALLOWED"
          ],
          "429": [
            "RATE_LIMITED"
          ],
          "500": [
            "INTERNAL"
          ],
          "501": [
            "NOT_IMPLEMENTED"
          ],
          "503": [
            "SERVICE_UNAVAILABLE"
          ]
        }
      }
    },
    "/v1/businesses/{businessId}/reports/report-2-6": {
      "get": {
        "operationId": "reports.report26",
        "tags": [
          "reports"
        ],
        "summary": "Report 2.6: the number and the total of the documents of each document code in a period.",
        "description": "API key with the scope `reports.read` (the creator's current role must hold it too). Heavy: at most 10 a minute per key.",
        "security": [
          {
            "apiKey": [
              "reports.read"
            ]
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "from",
            "in": "query",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/LocalDate"
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/LocalDate"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/Report26"
                    },
                    "requestId": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "ok",
                    "data",
                    "requestId"
                  ]
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error400"
          },
          "401": {
            "$ref": "#/components/responses/Error401"
          },
          "403": {
            "$ref": "#/components/responses/Error403"
          },
          "404": {
            "$ref": "#/components/responses/Error404"
          },
          "405": {
            "$ref": "#/components/responses/Error405"
          },
          "429": {
            "$ref": "#/components/responses/Error429"
          },
          "500": {
            "$ref": "#/components/responses/Error500"
          },
          "501": {
            "$ref": "#/components/responses/Error501"
          },
          "503": {
            "$ref": "#/components/responses/Error503"
          }
        },
        "x-scope": "reports.read",
        "x-rate-class": "heavy",
        "x-error-codes": {
          "400": [
            "VALIDATION_FAILED"
          ],
          "401": [
            "UNAUTHENTICATED"
          ],
          "403": [
            "FORBIDDEN",
            "ACCESS_EXPIRED"
          ],
          "404": [
            "NOT_FOUND"
          ],
          "405": [
            "METHOD_NOT_ALLOWED"
          ],
          "429": [
            "RATE_LIMITED"
          ],
          "500": [
            "INTERNAL"
          ],
          "501": [
            "NOT_IMPLEMENTED"
          ],
          "503": [
            "SERVICE_UNAVAILABLE"
          ]
        }
      }
    },
    "/v1/businesses/{businessId}/reports/sequence-check": {
      "get": {
        "operationId": "reports.sequenceCheck",
        "tags": [
          "reports"
        ],
        "summary": "The sequence check of each document series in a period: the numbers that exist and the missing ones.",
        "description": "API key with the scope `reports.read` (the creator's current role must hold it too). Heavy: at most 10 a minute per key.",
        "security": [
          {
            "apiKey": [
              "reports.read"
            ]
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "from",
            "in": "query",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/LocalDate"
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/LocalDate"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/SequenceCheckReport"
                    },
                    "requestId": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "ok",
                    "data",
                    "requestId"
                  ]
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error400"
          },
          "401": {
            "$ref": "#/components/responses/Error401"
          },
          "403": {
            "$ref": "#/components/responses/Error403"
          },
          "404": {
            "$ref": "#/components/responses/Error404"
          },
          "405": {
            "$ref": "#/components/responses/Error405"
          },
          "429": {
            "$ref": "#/components/responses/Error429"
          },
          "500": {
            "$ref": "#/components/responses/Error500"
          },
          "501": {
            "$ref": "#/components/responses/Error501"
          },
          "503": {
            "$ref": "#/components/responses/Error503"
          }
        },
        "x-scope": "reports.read",
        "x-rate-class": "heavy",
        "x-error-codes": {
          "400": [
            "VALIDATION_FAILED"
          ],
          "401": [
            "UNAUTHENTICATED"
          ],
          "403": [
            "FORBIDDEN",
            "ACCESS_EXPIRED"
          ],
          "404": [
            "NOT_FOUND"
          ],
          "405": [
            "METHOD_NOT_ALLOWED"
          ],
          "429": [
            "RATE_LIMITED"
          ],
          "500": [
            "INTERNAL"
          ],
          "501": [
            "NOT_IMPLEMENTED"
          ],
          "503": [
            "SERVICE_UNAVAILABLE"
          ]
        }
      }
    },
    "/v1/businesses/{businessId}/reports/vat": {
      "get": {
        "operationId": "reports.vat",
        "tags": [
          "reports"
        ],
        "summary": "The VAT summary of a period: sales, credits, and inputs split into fixed assets and others.",
        "description": "API key with the scope `reports.read` (the creator's current role must hold it too). A key's answer is `VatReport`, narrower than the app's: what it does not hold never reaches a key. Heavy: at most 10 a minute per key.",
        "security": [
          {
            "apiKey": [
              "reports.read"
            ]
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "from",
            "in": "query",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/LocalDate"
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/LocalDate"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/VatReport"
                    },
                    "requestId": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "ok",
                    "data",
                    "requestId"
                  ]
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error400"
          },
          "401": {
            "$ref": "#/components/responses/Error401"
          },
          "403": {
            "$ref": "#/components/responses/Error403"
          },
          "404": {
            "$ref": "#/components/responses/Error404"
          },
          "405": {
            "$ref": "#/components/responses/Error405"
          },
          "429": {
            "$ref": "#/components/responses/Error429"
          },
          "500": {
            "$ref": "#/components/responses/Error500"
          },
          "501": {
            "$ref": "#/components/responses/Error501"
          },
          "503": {
            "$ref": "#/components/responses/Error503"
          }
        },
        "x-scope": "reports.read",
        "x-rate-class": "heavy",
        "x-error-codes": {
          "400": [
            "VALIDATION_FAILED"
          ],
          "401": [
            "UNAUTHENTICATED"
          ],
          "403": [
            "FORBIDDEN",
            "ACCESS_EXPIRED"
          ],
          "404": [
            "NOT_FOUND"
          ],
          "405": [
            "METHOD_NOT_ALLOWED"
          ],
          "429": [
            "RATE_LIMITED"
          ],
          "500": [
            "INTERNAL"
          ],
          "501": [
            "NOT_IMPLEMENTED"
          ],
          "503": [
            "SERVICE_UNAVAILABLE"
          ]
        },
        "x-narrowed": [
          "response"
        ]
      }
    },
    "/v1/businesses/{businessId}/vat-report-filings": {
      "get": {
        "operationId": "expenses.listVatReportFilings",
        "tags": [
          "expenses"
        ],
        "summary": "Copies of the periodic VAT reports the business filed, kept with the books.",
        "description": "API key with the scope `expenses.read` (the creator's current role must hold it too).",
        "security": [
          {
            "apiKey": [
              "expenses.read"
            ]
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "const": true
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/VatReportFiling"
                      }
                    },
                    "requestId": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "ok",
                    "data",
                    "requestId"
                  ]
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error400"
          },
          "401": {
            "$ref": "#/components/responses/Error401"
          },
          "403": {
            "$ref": "#/components/responses/Error403"
          },
          "404": {
            "$ref": "#/components/responses/Error404"
          },
          "405": {
            "$ref": "#/components/responses/Error405"
          },
          "429": {
            "$ref": "#/components/responses/Error429"
          },
          "500": {
            "$ref": "#/components/responses/Error500"
          },
          "501": {
            "$ref": "#/components/responses/Error501"
          },
          "503": {
            "$ref": "#/components/responses/Error503"
          }
        },
        "x-scope": "expenses.read",
        "x-rate-class": "read",
        "x-error-codes": {
          "400": [
            "VALIDATION_FAILED"
          ],
          "401": [
            "UNAUTHENTICATED"
          ],
          "403": [
            "FORBIDDEN",
            "ACCESS_EXPIRED"
          ],
          "404": [
            "NOT_FOUND"
          ],
          "405": [
            "METHOD_NOT_ALLOWED"
          ],
          "429": [
            "RATE_LIMITED"
          ],
          "500": [
            "INTERNAL"
          ],
          "501": [
            "NOT_IMPLEMENTED"
          ],
          "503": [
            "SERVICE_UNAVAILABLE"
          ]
        }
      }
    }
  },
  "components": {
    "schemas": {
      "AccountingBasis": {
        "type": "string",
        "enum": [
          "cash",
          "accrual"
        ]
      },
      "Address": {
        "type": "object",
        "properties": {
          "street": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 100
              },
              {
                "type": "null"
              }
            ]
          },
          "houseNumber": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 20
              },
              {
                "type": "null"
              }
            ]
          },
          "city": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 60
              },
              {
                "type": "null"
              }
            ]
          },
          "zip": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 10
              },
              {
                "type": "null"
              }
            ]
          },
          "countryCode": {
            "$ref": "#/components/schemas/CountryCode"
          }
        },
        "required": [
          "street",
          "houseNumber",
          "city",
          "zip",
          "countryCode"
        ]
      },
      "AddressInput": {
        "type": "object",
        "properties": {
          "street": {
            "type": "string",
            "maxLength": 100
          },
          "houseNumber": {
            "type": "string",
            "maxLength": 20
          },
          "city": {
            "type": "string",
            "maxLength": 60
          },
          "zip": {
            "type": "string",
            "maxLength": 10
          },
          "countryCode": {
            "default": "IL",
            "$ref": "#/components/schemas/CountryCode"
          }
        },
        "additionalProperties": false
      },
      "AdvancesReport": {
        "type": "object",
        "properties": {
          "meta": {
            "$ref": "#/components/schemas/ReportMeta"
          },
          "turnover": {
            "$ref": "#/components/schemas/Agorot"
          },
          "advanceRateBp": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/BasisPoints"
              },
              {
                "type": "null"
              }
            ]
          },
          "advanceAmount": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Agorot"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "meta",
          "turnover",
          "advanceRateBp",
          "advanceAmount"
        ]
      },
      "Agorot": {
        "type": "integer",
        "minimum": 0,
        "maximum": 99999999999999
      },
      "AllocationNumber": {
        "type": "string",
        "pattern": "^\\d{9,30}$"
      },
      "ApiError": {
        "type": "object",
        "properties": {
          "code": {
            "$ref": "#/components/schemas/ErrorCode"
          },
          "message": {
            "type": "string",
            "minLength": 1,
            "maxLength": 500
          },
          "details": {
            "maxItems": 100,
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/FieldError"
            }
          },
          "retryable": {
            "type": "boolean"
          },
          "helpArticle": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^[a-z0-9-]{1,80}$"
              },
              {
                "type": "null"
              }
            ]
          },
          "requestId": {
            "$ref": "#/components/schemas/RequestId"
          }
        },
        "required": [
          "code",
          "message",
          "details",
          "retryable",
          "helpArticle",
          "requestId"
        ]
      },
      "ApiFailure": {
        "type": "object",
        "properties": {
          "ok": {
            "type": "boolean",
            "const": false
          },
          "error": {
            "$ref": "#/components/schemas/ApiError"
          }
        },
        "required": [
          "ok",
          "error"
        ]
      },
      "ArchivedDocument": {
        "type": "object",
        "properties": {
          "id": {
            "$ref": "#/components/schemas/Id"
          },
          "importId": {
            "$ref": "#/components/schemas/Id"
          },
          "openFormatCode": {
            "$ref": "#/components/schemas/OpenFormatDocCode"
          },
          "number": {
            "type": "string",
            "minLength": 1,
            "maxLength": 20
          },
          "documentDate": {
            "$ref": "#/components/schemas/LocalDate"
          },
          "customerName": {
            "type": "string",
            "maxLength": 120
          },
          "customerVatNumber": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^\\d{1,9}$"
              },
              {
                "type": "null"
              }
            ]
          },
          "gross": {
            "$ref": "#/components/schemas/SignedAgorot"
          },
          "cancelled": {
            "type": "boolean"
          },
          "sourceSoftwareName": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 80
              },
              {
                "type": "null"
              }
            ]
          },
          "marking": {
            "type": "string",
            "const": "imported"
          },
          "issuedAt": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Timestamp"
              },
              {
                "type": "null"
              }
            ]
          },
          "totals": {
            "type": "object",
            "properties": {
              "beforeDiscount": {
                "$ref": "#/components/schemas/SignedAgorot"
              },
              "discount": {
                "$ref": "#/components/schemas/SignedAgorot"
              },
              "net": {
                "$ref": "#/components/schemas/SignedAgorot"
              },
              "vat": {
                "$ref": "#/components/schemas/SignedAgorot"
              },
              "gross": {
                "$ref": "#/components/schemas/SignedAgorot"
              },
              "withholding": {
                "$ref": "#/components/schemas/SignedAgorot"
              }
            },
            "required": [
              "beforeDiscount",
              "discount",
              "net",
              "vat",
              "gross",
              "withholding"
            ]
          },
          "lines": {
            "maxItems": 2000,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "lineNo": {
                  "type": "integer",
                  "minimum": 1,
                  "maximum": 9007199254740991
                },
                "description": {
                  "type": "string",
                  "maxLength": 500
                },
                "quantity": {
                  "type": "string",
                  "pattern": "^-?\\d{1,12}(?:\\.\\d{1,4})?$"
                },
                "unitPrice": {
                  "$ref": "#/components/schemas/SignedAgorot"
                },
                "netTotal": {
                  "$ref": "#/components/schemas/SignedAgorot"
                },
                "vatRateBp": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 10000
                },
                "baseDocument": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "openFormatCode": {
                          "$ref": "#/components/schemas/OpenFormatDocCode"
                        },
                        "number": {
                          "type": "string",
                          "maxLength": 20
                        }
                      },
                      "required": [
                        "openFormatCode",
                        "number"
                      ]
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              },
              "required": [
                "lineNo",
                "description",
                "quantity",
                "unitPrice",
                "netTotal",
                "vatRateBp",
                "baseDocument"
              ]
            }
          },
          "payments": {
            "maxItems": 200,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "lineNo": {
                  "type": "integer",
                  "minimum": 1,
                  "maximum": 9007199254740991
                },
                "method": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/PaymentMethod"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "methodCode": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9
                },
                "amount": {
                  "$ref": "#/components/schemas/SignedAgorot"
                },
                "dueDate": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/LocalDate"
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              },
              "required": [
                "lineNo",
                "method",
                "methodCode",
                "amount",
                "dueDate"
              ]
            }
          },
          "originalFiles": {
            "maxItems": 20,
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/StoredFile"
            }
          }
        },
        "required": [
          "id",
          "importId",
          "openFormatCode",
          "number",
          "documentDate",
          "customerName",
          "customerVatNumber",
          "gross",
          "cancelled",
          "sourceSoftwareName",
          "marking",
          "issuedAt",
          "totals",
          "lines",
          "payments",
          "originalFiles"
        ]
      },
      "ArchivedDocumentSummary": {
        "type": "object",
        "properties": {
          "id": {
            "$ref": "#/components/schemas/Id"
          },
          "importId": {
            "$ref": "#/components/schemas/Id"
          },
          "openFormatCode": {
            "$ref": "#/components/schemas/OpenFormatDocCode"
          },
          "number": {
            "type": "string",
            "minLength": 1,
            "maxLength": 20
          },
          "documentDate": {
            "$ref": "#/components/schemas/LocalDate"
          },
          "customerName": {
            "type": "string",
            "maxLength": 120
          },
          "customerVatNumber": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^\\d{1,9}$"
              },
              {
                "type": "null"
              }
            ]
          },
          "gross": {
            "$ref": "#/components/schemas/SignedAgorot"
          },
          "cancelled": {
            "type": "boolean"
          },
          "sourceSoftwareName": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 80
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "importId",
          "openFormatCode",
          "number",
          "documentDate",
          "customerName",
          "customerVatNumber",
          "gross",
          "cancelled",
          "sourceSoftwareName"
        ]
      },
      "BadDebtNotice": {
        "type": "object",
        "properties": {
          "filedOn": {
            "$ref": "#/components/schemas/LocalDate"
          },
          "stampedCopy": {
            "$ref": "#/components/schemas/StoredFile"
          },
          "recordedAt": {
            "$ref": "#/components/schemas/Timestamp"
          },
          "recordedByUserId": {
            "$ref": "#/components/schemas/Id"
          }
        },
        "required": [
          "filedOn",
          "stampedCopy",
          "recordedAt",
          "recordedByUserId"
        ]
      },
      "BasisPoints": {
        "type": "integer",
        "minimum": 0,
        "maximum": 10000
      },
      "BusinessComplianceState": {
        "type": "object",
        "properties": {
          "registrationCertificateShownAt": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Timestamp"
              },
              {
                "type": "null"
              }
            ]
          },
          "computerizedDocumentsNoticeSentOn": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/LocalDate"
              },
              {
                "type": "null"
              }
            ]
          },
          "storageLetterGeneratedAt": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Timestamp"
              },
              {
                "type": "null"
              }
            ]
          },
          "storageLetterSentOn": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/LocalDate"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "registrationCertificateShownAt",
          "computerizedDocumentsNoticeSentOn",
          "storageLetterGeneratedAt",
          "storageLetterSentOn"
        ]
      },
      "BusinessStatus": {
        "type": "string",
        "enum": [
          "active",
          "closed",
          "purge_requested"
        ]
      },
      "BusinessTaxProfile": {
        "type": "object",
        "properties": {
          "vatReportingFrequency": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/VatReportingFrequency"
              },
              {
                "type": "null"
              }
            ]
          },
          "accountingBasis": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/AccountingBasis"
              },
              {
                "type": "null"
              }
            ]
          },
          "incomeTaxAdvanceRateBp": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/BasisPoints"
              },
              {
                "type": "null"
              }
            ]
          },
          "eilatResident": {
            "type": "boolean"
          },
          "goodsSellerRoles": {
            "maxItems": 3,
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/GoodsSellerRole"
            }
          },
          "withholdingFileNumber": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^\\d{9}$"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "vatReportingFrequency",
          "accountingBasis",
          "incomeTaxAdvanceRateBp",
          "eilatResident",
          "goodsSellerRoles",
          "withholdingFileNumber"
        ]
      },
      "CardAcquirer": {
        "type": "string",
        "enum": [
          "isracard",
          "cal",
          "diners",
          "amex",
          "max"
        ]
      },
      "CardDealType": {
        "type": "string",
        "enum": [
          "regular",
          "installments",
          "credit",
          "deferred",
          "other"
        ]
      },
      "ConsentState": {
        "type": "string",
        "enum": [
          "granted",
          "pending",
          "revoked",
          "not_required"
        ]
      },
      "ContentType": {
        "type": "string",
        "pattern": "^[a-z]+\\/[a-z0-9.+-]+$"
      },
      "CopyMarking": {
        "type": "string",
        "enum": [
          "draft",
          "original",
          "true_copy",
          "demo"
        ]
      },
      "CountryCode": {
        "type": "string",
        "pattern": "^[A-Z]{2}$"
      },
      "CreditAcknowledgement": {
        "type": "object",
        "properties": {
          "status": {
            "$ref": "#/components/schemas/CreditAcknowledgementStatus"
          },
          "method": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/CreditAcknowledgementMethod"
              },
              {
                "type": "null"
              }
            ]
          },
          "evidence": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/StoredFile"
              },
              {
                "type": "null"
              }
            ]
          },
          "acknowledgedAt": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Timestamp"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "status",
          "method",
          "evidence",
          "acknowledgedAt"
        ]
      },
      "CreditAcknowledgementMethod": {
        "type": "string",
        "enum": [
          "signed_copy",
          "registered_mail",
          "fax",
          "approved_esign",
          "other"
        ]
      },
      "CreditAcknowledgementStatus": {
        "type": "string",
        "enum": [
          "pending",
          "online_unverified",
          "acknowledged"
        ]
      },
      "CreditReason": {
        "type": "object",
        "properties": {
          "code": {
            "$ref": "#/components/schemas/CreditReasonCode"
          },
          "text": {
            "type": "string",
            "minLength": 1,
            "maxLength": 300
          }
        },
        "required": [
          "code",
          "text"
        ]
      },
      "CreditReasonCode": {
        "type": "string",
        "enum": [
          "cancelled",
          "terms_changed",
          "error",
          "amount_changed",
          "bad_debt",
          "other"
        ]
      },
      "CreditRefund": {
        "type": "object",
        "properties": {
          "method": {
            "$ref": "#/components/schemas/PaymentMethod"
          },
          "refundedOn": {
            "$ref": "#/components/schemas/LocalDate"
          },
          "amount": {
            "minimum": 1,
            "$ref": "#/components/schemas/Agorot"
          }
        },
        "required": [
          "method",
          "refundedOn",
          "amount"
        ]
      },
      "CreditRefundInput": {
        "type": "object",
        "properties": {
          "method": {
            "$ref": "#/components/schemas/PaymentMethod"
          },
          "refundedOn": {
            "$ref": "#/components/schemas/LocalDate"
          },
          "amount": {
            "minimum": 1,
            "$ref": "#/components/schemas/MinorUnits"
          }
        },
        "required": [
          "method",
          "refundedOn"
        ],
        "additionalProperties": false
      },
      "CurrencyCode": {
        "type": "string",
        "pattern": "^[A-Z]{3}$"
      },
      "Customer": {
        "type": "object",
        "properties": {
          "id": {
            "$ref": "#/components/schemas/Id"
          },
          "businessId": {
            "$ref": "#/components/schemas/Id"
          },
          "code": {
            "$ref": "#/components/schemas/CustomerCode"
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 120
          },
          "isDealer": {
            "type": "boolean"
          },
          "vatNumber": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/VatNumber"
              },
              {
                "type": "null"
              }
            ]
          },
          "allocationOptOut": {
            "type": "boolean"
          },
          "emails": {
            "maxItems": 5,
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Email"
            }
          },
          "phone": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Phone"
              },
              {
                "type": "null"
              }
            ]
          },
          "contactName": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              },
              {
                "type": "null"
              }
            ]
          },
          "address": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Address"
              },
              {
                "type": "null"
              }
            ]
          },
          "preferredLanguage": {
            "$ref": "#/components/schemas/DocumentLanguage"
          },
          "notes": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 2000
              },
              {
                "type": "null"
              }
            ]
          },
          "archived": {
            "type": "boolean"
          },
          "source": {
            "type": "string",
            "enum": [
              "manual",
              "import"
            ]
          },
          "createdAt": {
            "$ref": "#/components/schemas/Timestamp"
          },
          "updatedAt": {
            "$ref": "#/components/schemas/Timestamp"
          }
        },
        "required": [
          "id",
          "businessId",
          "code",
          "name",
          "isDealer",
          "vatNumber",
          "allocationOptOut",
          "emails",
          "phone",
          "contactName",
          "address",
          "preferredLanguage",
          "notes",
          "archived",
          "source",
          "createdAt",
          "updatedAt"
        ]
      },
      "CustomerCode": {
        "type": "string",
        "pattern": "^[A-Za-z0-9-]{1,15}$"
      },
      "CustomerInput": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 120
          },
          "isDealer": {
            "default": false,
            "type": "boolean"
          },
          "vatNumber": {
            "$ref": "#/components/schemas/VatNumber"
          },
          "allocationOptOut": {
            "default": false,
            "type": "boolean"
          },
          "emails": {
            "default": [],
            "maxItems": 5,
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Email"
            }
          },
          "phone": {
            "$ref": "#/components/schemas/Phone"
          },
          "contactName": {
            "type": "string",
            "minLength": 1,
            "maxLength": 120
          },
          "address": {
            "$ref": "#/components/schemas/AddressInput"
          },
          "preferredLanguage": {
            "default": "he",
            "$ref": "#/components/schemas/DocumentLanguage"
          },
          "notes": {
            "type": "string",
            "maxLength": 2000
          }
        },
        "required": [
          "name"
        ],
        "additionalProperties": false
      },
      "CustomerLedger": {
        "type": "object",
        "properties": {
          "meta": {
            "$ref": "#/components/schemas/ReportMeta"
          },
          "customerId": {
            "$ref": "#/components/schemas/Id"
          },
          "customerName": {
            "type": "string",
            "minLength": 1,
            "maxLength": 120
          },
          "previousSoftware": {
            "type": "object",
            "properties": {
              "amount": {
                "$ref": "#/components/schemas/SignedAgorot"
              },
              "asOf": {
                "$ref": "#/components/schemas/LocalDate"
              },
              "note": {
                "anyOf": [
                  {
                    "type": "string",
                    "maxLength": 200
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "amount",
              "asOf",
              "note"
            ]
          },
          "openingBalance": {
            "$ref": "#/components/schemas/SignedAgorot"
          },
          "rows": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CustomerLedgerRow"
            }
          },
          "debits": {
            "$ref": "#/components/schemas/Agorot"
          },
          "credits": {
            "$ref": "#/components/schemas/Agorot"
          },
          "closedByHand": {
            "$ref": "#/components/schemas/Agorot"
          },
          "closingBalance": {
            "$ref": "#/components/schemas/SignedAgorot"
          },
          "openDocuments": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/OpenDebtDocument"
            }
          }
        },
        "required": [
          "meta",
          "customerId",
          "customerName",
          "openingBalance",
          "rows",
          "debits",
          "credits",
          "closingBalance",
          "openDocuments"
        ]
      },
      "CustomerLedgerAdjustmentKind": {
        "type": "string",
        "enum": [
          "exchange_difference",
          "applied_elsewhere"
        ]
      },
      "CustomerLedgerRow": {
        "type": "object",
        "properties": {
          "documentId": {
            "$ref": "#/components/schemas/Id"
          },
          "type": {
            "$ref": "#/components/schemas/DocumentType"
          },
          "variant": {
            "$ref": "#/components/schemas/DocumentVariant"
          },
          "number": {
            "$ref": "#/components/schemas/DocumentNumber"
          },
          "documentDate": {
            "$ref": "#/components/schemas/LocalDate"
          },
          "dueDate": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/LocalDate"
              },
              {
                "type": "null"
              }
            ]
          },
          "gross": {
            "$ref": "#/components/schemas/Agorot"
          },
          "currency": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/CurrencyCode"
              },
              {
                "type": "null"
              }
            ]
          },
          "debit": {
            "$ref": "#/components/schemas/Agorot"
          },
          "credit": {
            "$ref": "#/components/schemas/Agorot"
          },
          "adjustment": {
            "$ref": "#/components/schemas/SignedAgorot"
          },
          "adjustmentKind": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/CustomerLedgerAdjustmentKind"
              },
              {
                "type": "null"
              }
            ]
          },
          "balance": {
            "$ref": "#/components/schemas/SignedAgorot"
          },
          "cancelled": {
            "type": "boolean"
          },
          "replaces": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "documentId": {
                  "$ref": "#/components/schemas/Id"
                },
                "type": {
                  "$ref": "#/components/schemas/DocumentType"
                },
                "number": {
                  "$ref": "#/components/schemas/DocumentNumber"
                }
              },
              "required": [
                "documentId",
                "type",
                "number"
              ]
            }
          },
          "otherCustomer": {
            "type": "boolean"
          }
        },
        "required": [
          "documentId",
          "type",
          "variant",
          "number",
          "documentDate",
          "dueDate",
          "gross",
          "currency",
          "debit",
          "credit",
          "adjustment",
          "adjustmentKind",
          "balance",
          "cancelled",
          "replaces",
          "otherCustomer"
        ]
      },
      "CustomerPreview": {
        "type": "object",
        "properties": {
          "customerId": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Id"
              },
              {
                "type": "null"
              }
            ]
          },
          "code": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/CustomerCode"
              },
              {
                "type": "null"
              }
            ]
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 120
          },
          "isDealer": {
            "type": "boolean"
          },
          "vatNumber": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/VatNumber"
              },
              {
                "type": "null"
              }
            ]
          },
          "address": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Address"
              },
              {
                "type": "null"
              }
            ]
          },
          "phone": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Phone"
              },
              {
                "type": "null"
              }
            ]
          },
          "emails": {
            "maxItems": 5,
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Email"
            }
          }
        },
        "required": [
          "customerId",
          "code",
          "name",
          "isDealer",
          "vatNumber",
          "address",
          "phone",
          "emails"
        ]
      },
      "CustomerSnapshot": {
        "type": "object",
        "properties": {
          "customerId": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Id"
              },
              {
                "type": "null"
              }
            ]
          },
          "code": {
            "$ref": "#/components/schemas/CustomerCode"
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 120
          },
          "isDealer": {
            "type": "boolean"
          },
          "vatNumber": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/VatNumber"
              },
              {
                "type": "null"
              }
            ]
          },
          "address": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Address"
              },
              {
                "type": "null"
              }
            ]
          },
          "phone": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Phone"
              },
              {
                "type": "null"
              }
            ]
          },
          "emails": {
            "maxItems": 5,
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Email"
            }
          }
        },
        "required": [
          "customerId",
          "code",
          "name",
          "isDealer",
          "vatNumber",
          "address",
          "phone",
          "emails"
        ]
      },
      "DealerType": {
        "type": "string",
        "enum": [
          "exempt",
          "licensed",
          "company"
        ]
      },
      "Delivery": {
        "type": "object",
        "properties": {
          "id": {
            "$ref": "#/components/schemas/Id"
          },
          "documentId": {
            "$ref": "#/components/schemas/Id"
          },
          "channel": {
            "type": "string",
            "enum": [
              "email",
              "whatsapp_share",
              "share_sheet"
            ]
          },
          "purpose": {
            "$ref": "#/components/schemas/DeliveryPurpose"
          },
          "recipientMasked": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 254
              },
              {
                "type": "null"
              }
            ]
          },
          "mode": {
            "type": "string",
            "enum": [
              "link_only",
              "attachment"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "queued",
              "sent",
              "delivered",
              "bounced",
              "complained",
              "failed",
              "shared"
            ]
          },
          "bounceType": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "hard",
                  "soft"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "renditionId": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Id"
              },
              {
                "type": "null"
              }
            ]
          },
          "marking": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/CopyMarking"
              },
              {
                "type": "null"
              }
            ]
          },
          "createdAt": {
            "$ref": "#/components/schemas/Timestamp"
          },
          "updatedAt": {
            "$ref": "#/components/schemas/Timestamp"
          }
        },
        "required": [
          "id",
          "documentId",
          "channel",
          "recipientMasked",
          "mode",
          "status",
          "bounceType",
          "renditionId",
          "marking",
          "createdAt",
          "updatedAt"
        ]
      },
      "DeliveryChannel": {
        "type": "string",
        "enum": [
          "email",
          "whatsapp_share",
          "share_sheet",
          "download",
          "print",
          "customer_page"
        ]
      },
      "DeliveryPurpose": {
        "type": "string",
        "enum": [
          "document",
          "payment_reminder"
        ]
      },
      "DepositDetails": {
        "type": "object",
        "properties": {
          "securedPurpose": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "agreedPeriodMonths": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": 1,
                "maximum": 120
              },
              {
                "type": "null"
              }
            ]
          },
          "becomesPriceOn": {
            "$ref": "#/components/schemas/LocalDate"
          },
          "status": {
            "type": "string",
            "enum": [
              "open",
              "returned",
              "applied"
            ]
          },
          "closedOn": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/LocalDate"
              },
              {
                "type": "null"
              }
            ]
          },
          "appliedByDocumentId": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Id"
              },
              {
                "type": "null"
              }
            ]
          },
          "note": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 500
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "securedPurpose",
          "agreedPeriodMonths",
          "becomesPriceOn",
          "status",
          "closedOn",
          "appliedByDocumentId",
          "note"
        ]
      },
      "DepositDetailsInput": {
        "type": "object",
        "properties": {
          "securedPurpose": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "agreedPeriodMonths": {
            "type": "integer",
            "minimum": 1,
            "maximum": 120
          }
        },
        "required": [
          "securedPurpose"
        ],
        "additionalProperties": false
      },
      "DeriveDocumentRequest": {
        "type": "object",
        "properties": {
          "newDocumentId": {
            "$ref": "#/components/schemas/Id"
          },
          "targetType": {
            "$ref": "#/components/schemas/DocumentType"
          },
          "targetVariant": {
            "default": "standard",
            "$ref": "#/components/schemas/DocumentVariant"
          },
          "titleVariant": {
            "$ref": "#/components/schemas/PaymentDemandTitle"
          },
          "mode": {
            "default": "full",
            "type": "string",
            "enum": [
              "full",
              "lines",
              "amount"
            ]
          },
          "lines": {
            "maxItems": 400,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "sourceLineNo": {
                  "type": "integer",
                  "minimum": 1,
                  "maximum": 9999
                },
                "quantity": {
                  "$ref": "#/components/schemas/Quantity"
                }
              },
              "required": [
                "sourceLineNo"
              ],
              "additionalProperties": false
            }
          },
          "amount": {
            "type": "object",
            "properties": {
              "description": {
                "type": "string",
                "minLength": 1,
                "maxLength": 500
              },
              "net": {
                "minimum": 1,
                "$ref": "#/components/schemas/MinorUnits"
              },
              "gross": {
                "minimum": 1,
                "$ref": "#/components/schemas/MinorUnits"
              },
              "vatTreatment": {
                "$ref": "#/components/schemas/VatTreatment"
              }
            },
            "required": [
              "description"
            ],
            "additionalProperties": false
          },
          "creditReason": {
            "type": "object",
            "properties": {
              "code": {
                "$ref": "#/components/schemas/CreditReasonCode"
              },
              "text": {
                "type": "string",
                "minLength": 1,
                "maxLength": 300
              }
            },
            "required": [
              "code",
              "text"
            ],
            "additionalProperties": false
          },
          "refund": {
            "$ref": "#/components/schemas/CreditRefundInput"
          },
          "paymentLineNo": {
            "$ref": "#/components/schemas/PaymentLineNo"
          }
        },
        "required": [
          "newDocumentId",
          "targetType"
        ],
        "additionalProperties": false
      },
      "DocumentAccent": {
        "type": "string",
        "enum": [
          "gold",
          "navy",
          "royal",
          "plum",
          "rust",
          "graphite"
        ]
      },
      "DocumentComputationResult": {
        "type": "object",
        "properties": {
          "lines": {
            "maxItems": 400,
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DocumentLine"
            }
          },
          "totals": {
            "$ref": "#/components/schemas/DocumentTotals"
          },
          "vatBreakdown": {
            "maxItems": 10,
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/VatBreakdownRow"
            }
          },
          "foreign": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/ForeignCurrency"
              },
              {
                "type": "null"
              }
            ]
          },
          "errors": {
            "maxItems": 100,
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/FieldError"
            }
          },
          "warnings": {
            "maxItems": 100,
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/FieldError"
            }
          },
          "allocationRequired": {
            "type": [
              "boolean",
              "null"
            ]
          },
          "printedNotices": {
            "maxItems": 20,
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PrintedNotice"
            }
          },
          "grossDifferenceFromTyped": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          }
        },
        "required": [
          "lines",
          "totals",
          "vatBreakdown",
          "foreign",
          "errors",
          "warnings",
          "allocationRequired",
          "printedNotices",
          "grossDifferenceFromTyped"
        ]
      },
      "DocumentLanguage": {
        "type": "string",
        "enum": [
          "he",
          "he_en"
        ]
      },
      "DocumentLayout": {
        "type": "string",
        "enum": [
          "bold",
          "classic"
        ]
      },
      "DocumentLine": {
        "type": "object",
        "properties": {
          "lineNo": {
            "type": "integer",
            "minimum": 1,
            "maximum": 9999
          },
          "itemId": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Id"
              },
              {
                "type": "null"
              }
            ]
          },
          "itemCode": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/ItemCode"
              },
              {
                "type": "null"
              }
            ]
          },
          "kind": {
            "$ref": "#/components/schemas/LineKind"
          },
          "description": {
            "type": "string",
            "minLength": 1,
            "maxLength": 500
          },
          "unitName": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 30
              },
              {
                "type": "null"
              }
            ]
          },
          "quantity": {
            "$ref": "#/components/schemas/Quantity"
          },
          "unitPriceNet": {
            "$ref": "#/components/schemas/Agorot"
          },
          "unitPriceGross": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Agorot"
              },
              {
                "type": "null"
              }
            ]
          },
          "discount": {
            "$ref": "#/components/schemas/Agorot"
          },
          "netTotal": {
            "$ref": "#/components/schemas/Agorot"
          },
          "discountGross": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Agorot"
              },
              {
                "type": "null"
              }
            ]
          },
          "grossTotal": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Agorot"
              },
              {
                "type": "null"
              }
            ]
          },
          "vatTreatment": {
            "$ref": "#/components/schemas/VatTreatment"
          },
          "vatRateBp": {
            "$ref": "#/components/schemas/VatRateBasisPoints"
          },
          "foreign": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "unitPrice": {
                    "$ref": "#/components/schemas/MinorUnits"
                  },
                  "netTotal": {
                    "$ref": "#/components/schemas/MinorUnits"
                  },
                  "grossTotal": {
                    "anyOf": [
                      {
                        "$ref": "#/components/schemas/MinorUnits"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "unitPrice",
                  "netTotal"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "sourceDocumentId": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Id"
              },
              {
                "type": "null"
              }
            ]
          },
          "vatReason": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/VatReason"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "lineNo",
          "itemId",
          "itemCode",
          "kind",
          "description",
          "unitName",
          "quantity",
          "unitPriceNet",
          "unitPriceGross",
          "discount",
          "netTotal",
          "vatTreatment",
          "vatRateBp",
          "foreign",
          "sourceDocumentId"
        ]
      },
      "DocumentLineInput": {
        "type": "object",
        "properties": {
          "itemId": {
            "$ref": "#/components/schemas/Id"
          },
          "kind": {
            "default": "service",
            "$ref": "#/components/schemas/LineKind"
          },
          "description": {
            "type": "string",
            "minLength": 1,
            "maxLength": 500
          },
          "unitName": {
            "type": "string",
            "minLength": 1,
            "maxLength": 30
          },
          "quantity": {
            "$ref": "#/components/schemas/Quantity"
          },
          "unitPrice": {
            "$ref": "#/components/schemas/MinorUnits"
          },
          "discount": {
            "default": 0,
            "$ref": "#/components/schemas/MinorUnits"
          },
          "vatTreatment": {
            "default": "standard",
            "$ref": "#/components/schemas/VatTreatment"
          },
          "vatReason": {
            "$ref": "#/components/schemas/VatReasonInput"
          },
          "vatRateBp": {
            "$ref": "#/components/schemas/VatRateBasisPoints"
          },
          "sourceDocumentId": {
            "$ref": "#/components/schemas/Id"
          }
        },
        "required": [
          "description",
          "quantity",
          "unitPrice"
        ],
        "additionalProperties": false
      },
      "DocumentLook": {
        "type": "object",
        "properties": {
          "layout": {
            "$ref": "#/components/schemas/DocumentLayout"
          },
          "accent": {
            "$ref": "#/components/schemas/DocumentAccent"
          }
        },
        "required": [
          "layout",
          "accent"
        ]
      },
      "DocumentNumber": {
        "type": "integer",
        "minimum": 1,
        "maximum": 999999999999
      },
      "DocumentNumberRange": {
        "type": "object",
        "properties": {
          "from": {
            "$ref": "#/components/schemas/DocumentNumber"
          },
          "to": {
            "$ref": "#/components/schemas/DocumentNumber"
          }
        },
        "required": [
          "from",
          "to"
        ]
      },
      "DocumentReference": {
        "type": "object",
        "properties": {
          "relation": {
            "$ref": "#/components/schemas/DocumentRelation"
          },
          "documentId": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Id"
              },
              {
                "type": "null"
              }
            ]
          },
          "documentType": {
            "$ref": "#/components/schemas/DocumentType"
          },
          "number": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/DocumentNumber"
              },
              {
                "type": "null"
              }
            ]
          },
          "seriesPrefix": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/SeriesPrefix"
              },
              {
                "type": "null"
              }
            ]
          },
          "documentDate": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/LocalDate"
              },
              {
                "type": "null"
              }
            ]
          },
          "paymentLineNo": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/PaymentLineNo"
              },
              {
                "type": "null"
              }
            ]
          },
          "external": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/ExternalDocumentReference"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "relation",
          "documentId",
          "documentType",
          "number",
          "seriesPrefix",
          "documentDate"
        ]
      },
      "DocumentReferenceInput": {
        "type": "object",
        "properties": {
          "relation": {
            "$ref": "#/components/schemas/DocumentRelation"
          },
          "documentId": {
            "$ref": "#/components/schemas/Id"
          },
          "external": {
            "$ref": "#/components/schemas/ExternalDocumentReferenceInput"
          },
          "paymentLineNo": {
            "$ref": "#/components/schemas/PaymentLineNo"
          }
        },
        "required": [
          "relation"
        ],
        "additionalProperties": false
      },
      "DocumentRelation": {
        "type": "string",
        "enum": [
          "credits",
          "based_on",
          "pays",
          "converted_from",
          "supplements",
          "replaces",
          "applies_deposit",
          "invoices_payment"
        ]
      },
      "DocumentStatus": {
        "type": "string",
        "enum": [
          "draft",
          "issued"
        ]
      },
      "DocumentTotals": {
        "type": "object",
        "properties": {
          "linesNet": {
            "$ref": "#/components/schemas/Agorot"
          },
          "documentDiscount": {
            "$ref": "#/components/schemas/Agorot"
          },
          "netAfterDiscount": {
            "$ref": "#/components/schemas/Agorot"
          },
          "vat": {
            "$ref": "#/components/schemas/Agorot"
          },
          "gross": {
            "$ref": "#/components/schemas/Agorot"
          },
          "withholding": {
            "$ref": "#/components/schemas/Agorot"
          },
          "paymentsTotal": {
            "$ref": "#/components/schemas/Agorot"
          },
          "nationalInsurance": {
            "$ref": "#/components/schemas/Agorot"
          },
          "documentDiscountGross": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Agorot"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "linesNet",
          "documentDiscount",
          "netAfterDiscount",
          "vat",
          "gross",
          "withholding",
          "paymentsTotal"
        ]
      },
      "DocumentType": {
        "type": "string",
        "enum": [
          "quote",
          "order",
          "delivery_note",
          "return_note",
          "payment_demand",
          "tax_invoice",
          "tax_invoice_receipt",
          "credit_invoice",
          "receipt"
        ]
      },
      "DocumentVariant": {
        "type": "string",
        "enum": [
          "standard",
          "self_invoice",
          "supplementary",
          "deposit"
        ]
      },
      "Done": {
        "type": "object",
        "properties": {
          "done": {
            "type": "boolean",
            "const": true
          }
        },
        "required": [
          "done"
        ]
      },
      "DownloadLink": {
        "type": "object",
        "properties": {
          "url": {
            "type": "string",
            "maxLength": 2048,
            "format": "uri"
          },
          "expiresAt": {
            "$ref": "#/components/schemas/Timestamp"
          },
          "fileName": {
            "$ref": "#/components/schemas/FileName"
          },
          "contentType": {
            "$ref": "#/components/schemas/ContentType"
          },
          "sizeBytes": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ]
          },
          "sha256": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Sha256Hex"
              },
              {
                "type": "null"
              }
            ]
          },
          "marking": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/CopyMarking"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "url",
          "expiresAt",
          "fileName",
          "contentType",
          "sizeBytes",
          "sha256",
          "marking"
        ]
      },
      "Email": {
        "type": "string",
        "maxLength": 254,
        "format": "email"
      },
      "ErrorCode": {
        "type": "string",
        "enum": [
          "VALIDATION_FAILED",
          "UNAUTHENTICATED",
          "FORBIDDEN",
          "NOT_FOUND",
          "METHOD_NOT_ALLOWED",
          "CONFLICT",
          "IDEMPOTENCY_KEY_REQUIRED",
          "IDEMPOTENCY_KEY_REUSED",
          "IDEMPOTENCY_REQUEST_IN_PROGRESS",
          "RATE_LIMITED",
          "PAYLOAD_TOO_LARGE",
          "UNSUPPORTED_MEDIA_TYPE",
          "SERVICE_UNAVAILABLE",
          "NOT_IMPLEMENTED",
          "INTERNAL",
          "SECOND_FACTOR_REQUIRED",
          "SECOND_FACTOR_ENROLLMENT_REQUIRED",
          "STEP_UP_REQUIRED",
          "AUTH_CODE_INVALID",
          "AUTH_CHALLENGE_EXPIRED",
          "PASSKEY_VERIFICATION_FAILED",
          "LAST_SECOND_FACTOR",
          "OAUTH_PROVIDER_DISABLED",
          "OAUTH_VERIFICATION_FAILED",
          "IDENTITY_ALREADY_LINKED",
          "ACCESS_EXPIRED",
          "INVITATION_EXPIRED",
          "SOFTWARE_NOT_REGISTERED",
          "DIGITAL_SENDING_DISABLED",
          "BUSINESS_READ_ONLY",
          "RETENTION_PERIOD_NOT_OVER",
          "SOLE_OWNER_CANNOT_LEAVE",
          "DOCUMENT_IMMUTABLE",
          "DOCUMENT_NOT_ISSUED",
          "DOCUMENT_TYPE_NOT_ALLOWED",
          "TOTALS_CHANGED",
          "USE_CREDIT_NOTE",
          "USE_NEW_TAX_INVOICE",
          "CREDIT_EXCEEDS_REMAINING",
          "BAD_DEBT_TOO_EARLY",
          "BAD_DEBT_TOO_LATE",
          "STARTING_NUMBER_LOCKED",
          "ORIGINAL_ALREADY_DELIVERED",
          "PAPER_DELIVERY_REQUIRED",
          "CONSENT_REQUIRED",
          "CONSENT_REVOKED",
          "RECIPIENT_SUPPRESSED",
          "SENDING_LIMIT_REACHED",
          "ALLOCATION_PENDING",
          "ALLOCATION_DECISION_REQUIRED",
          "ALLOCATION_NOT_ELIGIBLE",
          "TAX_AUTHORITY_NOT_CONNECTED",
          "TAX_AUTHORITY_RECONNECT_REQUIRED",
          "TAX_AUTHORITY_NO_PERMISSION",
          "TAX_AUTHORITY_UNAVAILABLE",
          "OAUTH_STATE_INVALID",
          "EXPENSE_LOCKED",
          "UPLOAD_INVALID",
          "IMPORT_FILE_INVALID",
          "JOB_NOT_READY"
        ]
      },
      "ExchangeRate": {
        "type": "string",
        "pattern": "^(?!0+(?:\\.0+)?$)\\d{1,6}(?:\\.\\d{1,6})?$"
      },
      "ExpenseAttachment": {
        "type": "object",
        "properties": {
          "objectKey": {
            "$ref": "#/components/schemas/ObjectKey"
          },
          "contentType": {
            "type": "string",
            "pattern": "^[a-z]+\\/[a-z0-9.+-]+$"
          },
          "sizeBytes": {
            "type": "integer",
            "minimum": 0,
            "maximum": 104857600
          },
          "sha256": {
            "$ref": "#/components/schemas/Sha256Hex"
          },
          "uploadId": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Id"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "objectKey",
          "contentType",
          "sizeBytes",
          "sha256"
        ]
      },
      "ExpenseCategory": {
        "type": "string",
        "pattern": "^[a-z0-9_]{1,40}$"
      },
      "ExpenseCategoryDef": {
        "type": "object",
        "properties": {
          "slug": {
            "$ref": "#/components/schemas/ExpenseCategory"
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 60
          },
          "defaultInputClass": {
            "$ref": "#/components/schemas/ExpenseInputClass"
          },
          "archived": {
            "type": "boolean"
          }
        },
        "required": [
          "slug",
          "name",
          "defaultInputClass",
          "archived"
        ]
      },
      "ExpenseForeignAmount": {
        "type": "object",
        "properties": {
          "currency": {
            "$ref": "#/components/schemas/CurrencyCode"
          },
          "foreignGross": {
            "$ref": "#/components/schemas/MinorUnits"
          },
          "foreignVat": {
            "$ref": "#/components/schemas/MinorUnits"
          },
          "foreignNet": {
            "$ref": "#/components/schemas/MinorUnits"
          },
          "rate": {
            "$ref": "#/components/schemas/ExchangeRate"
          },
          "rateDate": {
            "$ref": "#/components/schemas/LocalDate"
          },
          "source": {
            "$ref": "#/components/schemas/ExpenseFxSource"
          },
          "ilsMethod": {
            "$ref": "#/components/schemas/ExpenseIlsMethod"
          }
        },
        "required": [
          "currency",
          "foreignGross",
          "foreignVat",
          "foreignNet",
          "rate",
          "rateDate",
          "source",
          "ilsMethod"
        ]
      },
      "ExpenseForeignSupplier": {
        "type": "object",
        "properties": {
          "taxId": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 30
              },
              {
                "type": "null"
              }
            ]
          },
          "countryCode": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/CountryCode"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "taxId",
          "countryCode"
        ]
      },
      "ExpenseFxCurrency": {
        "type": "string",
        "pattern": "^[A-Z]{3}$"
      },
      "ExpenseFxSource": {
        "type": "string",
        "enum": [
          "boi",
          "manual",
          "document",
          "charged"
        ]
      },
      "ExpenseIlsMethod": {
        "type": "string",
        "enum": [
          "converted",
          "typed"
        ]
      },
      "ExpenseInputClass": {
        "type": "string",
        "enum": [
          "fixed_assets",
          "other"
        ]
      },
      "ExpenseKind": {
        "type": "string",
        "enum": [
          "supplier_tax_invoice",
          "supplier_credit",
          "receipt_only",
          "other"
        ]
      },
      "ExpenseRecordedHow": {
        "type": "string",
        "enum": [
          "auto",
          "one_tap",
          "batch",
          "form"
        ]
      },
      "ExpenseSelfInvoiceLink": {
        "type": "object",
        "properties": {
          "documentId": {
            "$ref": "#/components/schemas/Id"
          },
          "number": {
            "$ref": "#/components/schemas/DocumentNumber"
          },
          "seriesPrefix": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/SeriesPrefix"
              },
              {
                "type": "null"
              }
            ]
          },
          "documentDate": {
            "$ref": "#/components/schemas/LocalDate"
          },
          "inputExpenseId": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Id"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "documentId",
          "number",
          "seriesPrefix",
          "documentDate",
          "inputExpenseId"
        ]
      },
      "ExpenseSource": {
        "type": "string",
        "enum": [
          "mail"
        ]
      },
      "ExpenseSupplier": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 120
          },
          "vatNumber": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/VatNumber"
              },
              {
                "type": "null"
              }
            ]
          },
          "isDealer": {
            "type": "boolean"
          }
        },
        "required": [
          "name",
          "vatNumber",
          "isDealer"
        ]
      },
      "ExpenseVatTreatment": {
        "type": "string",
        "enum": [
          "standard",
          "mixed",
          "eilat",
          "zero_rate",
          "reverse_charge_zero",
          "exempt_dealer",
          "no_vat_document",
          "foreign_supplier",
          "import_entry",
          "self_invoice_input"
        ]
      },
      "ExpensesReport": {
        "type": "object",
        "properties": {
          "meta": {
            "$ref": "#/components/schemas/ReportMeta"
          },
          "byCategory": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "category": {
                  "type": "string",
                  "maxLength": 40
                },
                "categoryName": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 60
                },
                "inputClass": {
                  "$ref": "#/components/schemas/ExpenseInputClass"
                },
                "count": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                },
                "net": {
                  "$ref": "#/components/schemas/Agorot"
                },
                "vat": {
                  "$ref": "#/components/schemas/Agorot"
                },
                "deductibleVat": {
                  "$ref": "#/components/schemas/Agorot"
                },
                "gross": {
                  "$ref": "#/components/schemas/Agorot"
                }
              },
              "required": [
                "category",
                "categoryName",
                "inputClass",
                "count",
                "net",
                "vat",
                "deductibleVat",
                "gross"
              ]
            }
          },
          "months": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "month": {
                  "$ref": "#/components/schemas/YearMonth"
                },
                "net": {
                  "$ref": "#/components/schemas/Agorot"
                },
                "vat": {
                  "$ref": "#/components/schemas/Agorot"
                },
                "gross": {
                  "$ref": "#/components/schemas/Agorot"
                }
              },
              "required": [
                "month",
                "net",
                "vat",
                "gross"
              ]
            }
          },
          "totals": {
            "type": "object",
            "properties": {
              "net": {
                "$ref": "#/components/schemas/Agorot"
              },
              "vat": {
                "$ref": "#/components/schemas/Agorot"
              },
              "deductibleVat": {
                "$ref": "#/components/schemas/Agorot"
              },
              "gross": {
                "$ref": "#/components/schemas/Agorot"
              }
            },
            "required": [
              "net",
              "vat",
              "deductibleVat",
              "gross"
            ]
          },
          "byCurrency": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "currency": {
                  "$ref": "#/components/schemas/CurrencyCode"
                },
                "count": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                },
                "foreignGross": {
                  "$ref": "#/components/schemas/MinorUnits"
                },
                "gross": {
                  "$ref": "#/components/schemas/Agorot"
                }
              },
              "required": [
                "currency",
                "count",
                "foreignGross",
                "gross"
              ]
            }
          },
          "foreignExpenses": {
            "maxItems": 5000,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "expenseId": {
                  "$ref": "#/components/schemas/Id"
                },
                "documentDate": {
                  "$ref": "#/components/schemas/LocalDate"
                },
                "kind": {
                  "$ref": "#/components/schemas/ExpenseKind"
                },
                "supplierName": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 120
                },
                "supplierDocumentNumber": {
                  "anyOf": [
                    {
                      "type": "string",
                      "maxLength": 20
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "vatTreatment": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/ExpenseVatTreatment"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "currency": {
                  "$ref": "#/components/schemas/CurrencyCode"
                },
                "foreignGross": {
                  "$ref": "#/components/schemas/MinorUnits"
                },
                "foreignVat": {
                  "$ref": "#/components/schemas/MinorUnits"
                },
                "rate": {
                  "$ref": "#/components/schemas/ExchangeRate"
                },
                "rateDate": {
                  "$ref": "#/components/schemas/LocalDate"
                },
                "source": {
                  "$ref": "#/components/schemas/ExpenseFxSource"
                },
                "ilsMethod": {
                  "$ref": "#/components/schemas/ExpenseIlsMethod"
                },
                "gross": {
                  "$ref": "#/components/schemas/Agorot"
                },
                "deductibleVat": {
                  "$ref": "#/components/schemas/Agorot"
                }
              },
              "required": [
                "expenseId",
                "documentDate",
                "kind",
                "supplierName",
                "supplierDocumentNumber",
                "vatTreatment",
                "currency",
                "foreignGross",
                "foreignVat",
                "rate",
                "rateDate",
                "source",
                "ilsMethod",
                "gross",
                "deductibleVat"
              ]
            }
          },
          "foreignExpensesTruncated": {
            "type": "boolean"
          },
          "byVatTreatment": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "vatTreatment": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/ExpenseVatTreatment"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "count": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                },
                "net": {
                  "$ref": "#/components/schemas/Agorot"
                },
                "vat": {
                  "$ref": "#/components/schemas/Agorot"
                },
                "deductibleVat": {
                  "$ref": "#/components/schemas/Agorot"
                }
              },
              "required": [
                "vatTreatment",
                "count",
                "net",
                "vat",
                "deductibleVat"
              ]
            }
          }
        },
        "required": [
          "meta",
          "byCategory",
          "months",
          "totals"
        ]
      },
      "ExternalDocumentReference": {
        "type": "object",
        "properties": {
          "source": {
            "type": "string",
            "enum": [
              "archive",
              "typed"
            ]
          },
          "archiveDocumentId": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Id"
              },
              {
                "type": "null"
              }
            ]
          },
          "number": {
            "type": "string",
            "minLength": 1,
            "maxLength": 20
          },
          "documentDate": {
            "$ref": "#/components/schemas/LocalDate"
          },
          "gross": {
            "$ref": "#/components/schemas/Agorot"
          }
        },
        "required": [
          "source",
          "archiveDocumentId",
          "number",
          "documentDate",
          "gross"
        ]
      },
      "ExternalDocumentReferenceInput": {
        "oneOf": [
          {
            "type": "object",
            "properties": {
              "source": {
                "type": "string",
                "const": "archive"
              },
              "archiveDocumentId": {
                "$ref": "#/components/schemas/Id"
              }
            },
            "required": [
              "source",
              "archiveDocumentId"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "source": {
                "type": "string",
                "const": "typed"
              },
              "documentType": {
                "$ref": "#/components/schemas/PreSwitchDocumentType"
              },
              "number": {
                "$ref": "#/components/schemas/PreSwitchDocumentNumber"
              },
              "documentDate": {
                "$ref": "#/components/schemas/LocalDate"
              },
              "gross": {
                "minimum": 1,
                "$ref": "#/components/schemas/Agorot"
              }
            },
            "required": [
              "source",
              "documentType",
              "number",
              "documentDate",
              "gross"
            ],
            "additionalProperties": false
          }
        ]
      },
      "FieldError": {
        "type": "object",
        "properties": {
          "path": {
            "type": "array",
            "items": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                }
              ]
            }
          },
          "code": {
            "type": "string",
            "maxLength": 64
          },
          "message": {
            "type": "string",
            "maxLength": 500
          }
        },
        "required": [
          "path",
          "code",
          "message"
        ]
      },
      "FileName": {
        "type": "string",
        "minLength": 1,
        "maxLength": 200
      },
      "ForeignCurrency": {
        "type": "object",
        "properties": {
          "rate": {
            "$ref": "#/components/schemas/ExchangeRate"
          },
          "rateDate": {
            "$ref": "#/components/schemas/LocalDate"
          },
          "source": {
            "$ref": "#/components/schemas/FxSource"
          },
          "grossMinor": {
            "$ref": "#/components/schemas/MinorUnits"
          }
        },
        "required": [
          "rate",
          "rateDate",
          "source",
          "grossMinor"
        ]
      },
      "ForeignPaymentAmount": {
        "type": "object",
        "properties": {
          "currency": {
            "$ref": "#/components/schemas/CurrencyCode"
          },
          "amountMinor": {
            "minimum": 1,
            "$ref": "#/components/schemas/MinorUnits"
          }
        },
        "required": [
          "currency",
          "amountMinor"
        ]
      },
      "FxSource": {
        "type": "string",
        "enum": [
          "boi",
          "manual"
        ]
      },
      "GoodsSellerRole": {
        "type": "string",
        "enum": [
          "manufacturer",
          "wholesaler",
          "farmer"
        ]
      },
      "Id": {
        "type": "string",
        "format": "uuid"
      },
      "IncomeReport": {
        "type": "object",
        "properties": {
          "meta": {
            "$ref": "#/components/schemas/ReportMeta"
          },
          "basis": {
            "type": "string",
            "enum": [
              "tax_invoices",
              "receipts"
            ]
          },
          "months": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "month": {
                  "$ref": "#/components/schemas/YearMonth"
                },
                "net": {
                  "$ref": "#/components/schemas/SignedAgorot"
                },
                "vat": {
                  "$ref": "#/components/schemas/SignedAgorot"
                },
                "gross": {
                  "$ref": "#/components/schemas/SignedAgorot"
                },
                "documents": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                },
                "creditsNet": {
                  "$ref": "#/components/schemas/SignedAgorot"
                }
              },
              "required": [
                "month",
                "net",
                "vat",
                "gross",
                "documents",
                "creditsNet"
              ]
            }
          },
          "byDocumentType": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "type": {
                  "$ref": "#/components/schemas/DocumentType"
                },
                "count": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                },
                "net": {
                  "$ref": "#/components/schemas/SignedAgorot"
                },
                "vat": {
                  "$ref": "#/components/schemas/SignedAgorot"
                },
                "gross": {
                  "$ref": "#/components/schemas/SignedAgorot"
                }
              },
              "required": [
                "type",
                "count",
                "net",
                "vat",
                "gross"
              ]
            }
          },
          "totals": {
            "type": "object",
            "properties": {
              "net": {
                "$ref": "#/components/schemas/SignedAgorot"
              },
              "vat": {
                "$ref": "#/components/schemas/SignedAgorot"
              },
              "gross": {
                "$ref": "#/components/schemas/SignedAgorot"
              }
            },
            "required": [
              "net",
              "vat",
              "gross"
            ]
          },
          "filters": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/IncomeReportFilters"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "meta",
          "basis",
          "months",
          "byDocumentType",
          "totals"
        ]
      },
      "IncomeReportFilters": {
        "type": "object",
        "properties": {
          "customerId": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Id"
              },
              {
                "type": "null"
              }
            ]
          },
          "customerName": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              },
              {
                "type": "null"
              }
            ]
          },
          "documentType": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/DocumentType"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "customerId",
          "customerName",
          "documentType"
        ]
      },
      "IssuedVia": {
        "type": "string",
        "enum": [
          "interactive",
          "offline_queue",
          "recurring"
        ]
      },
      "Item": {
        "type": "object",
        "properties": {
          "id": {
            "$ref": "#/components/schemas/Id"
          },
          "businessId": {
            "$ref": "#/components/schemas/Id"
          },
          "code": {
            "$ref": "#/components/schemas/ItemCode"
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 120
          },
          "description": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 1000
              },
              {
                "type": "null"
              }
            ]
          },
          "kind": {
            "$ref": "#/components/schemas/LineKind"
          },
          "unitName": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 30
              },
              {
                "type": "null"
              }
            ]
          },
          "unitPrice": {
            "$ref": "#/components/schemas/Agorot"
          },
          "priceIncludesVat": {
            "type": "boolean"
          },
          "vatTreatment": {
            "$ref": "#/components/schemas/VatTreatment"
          },
          "vatReason": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/VatReason"
              },
              {
                "type": "null"
              }
            ]
          },
          "barcode": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^[!-~]{1,20}$"
              },
              {
                "type": "null"
              }
            ]
          },
          "categoryCode": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 10
              },
              {
                "type": "null"
              }
            ]
          },
          "categoryName": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 30
              },
              {
                "type": "null"
              }
            ]
          },
          "archived": {
            "type": "boolean"
          },
          "createdAt": {
            "$ref": "#/components/schemas/Timestamp"
          },
          "updatedAt": {
            "$ref": "#/components/schemas/Timestamp"
          }
        },
        "required": [
          "id",
          "businessId",
          "code",
          "name",
          "description",
          "kind",
          "unitName",
          "unitPrice",
          "priceIncludesVat",
          "vatTreatment",
          "barcode",
          "categoryCode",
          "categoryName",
          "archived",
          "createdAt",
          "updatedAt"
        ]
      },
      "ItemCode": {
        "type": "string",
        "pattern": "^(?!!+$)[!-~]{1,20}$"
      },
      "ItemInput": {
        "type": "object",
        "properties": {
          "code": {
            "$ref": "#/components/schemas/ItemCode"
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 120
          },
          "description": {
            "type": "string",
            "maxLength": 1000
          },
          "kind": {
            "default": "service",
            "$ref": "#/components/schemas/LineKind"
          },
          "unitName": {
            "type": "string",
            "minLength": 1,
            "maxLength": 30
          },
          "unitPrice": {
            "$ref": "#/components/schemas/Agorot"
          },
          "priceIncludesVat": {
            "default": false,
            "type": "boolean"
          },
          "vatTreatment": {
            "default": "standard",
            "$ref": "#/components/schemas/VatTreatment"
          },
          "vatReason": {
            "$ref": "#/components/schemas/VatReasonInput"
          },
          "barcode": {
            "type": "string",
            "pattern": "^[!-~]{1,20}$"
          },
          "categoryCode": {
            "type": "string",
            "maxLength": 10
          },
          "categoryName": {
            "type": "string",
            "maxLength": 30
          }
        },
        "required": [
          "name",
          "unitPrice"
        ],
        "additionalProperties": false
      },
      "JobStatus": {
        "type": "string",
        "enum": [
          "queued",
          "running",
          "ready",
          "failed",
          "expired"
        ]
      },
      "LineKind": {
        "type": "string",
        "enum": [
          "service",
          "goods"
        ]
      },
      "LocalDate": {
        "type": "string",
        "format": "date"
      },
      "LocalTime": {
        "type": "string",
        "pattern": "^(?:[01]\\d|2[0-3]):[0-5]\\d$"
      },
      "MinorUnits": {
        "type": "integer",
        "minimum": 0,
        "maximum": 99999999999999
      },
      "ObjectKey": {
        "type": "string",
        "minLength": 1,
        "maxLength": 512,
        "pattern": "^[A-Za-z0-9!_.*'()/-]+$"
      },
      "OneOffCustomerInput": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 120
          },
          "isDealer": {
            "default": false,
            "type": "boolean"
          },
          "vatNumber": {
            "$ref": "#/components/schemas/VatNumber"
          },
          "emails": {
            "default": [],
            "maxItems": 5,
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Email"
            }
          },
          "phone": {
            "$ref": "#/components/schemas/Phone"
          },
          "address": {
            "$ref": "#/components/schemas/AddressInput"
          }
        },
        "required": [
          "name"
        ],
        "additionalProperties": false
      },
      "OpenDebtDocument": {
        "type": "object",
        "properties": {
          "documentId": {
            "$ref": "#/components/schemas/Id"
          },
          "type": {
            "$ref": "#/components/schemas/DocumentType"
          },
          "number": {
            "$ref": "#/components/schemas/DocumentNumber"
          },
          "documentDate": {
            "$ref": "#/components/schemas/LocalDate"
          },
          "dueDate": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/LocalDate"
              },
              {
                "type": "null"
              }
            ]
          },
          "gross": {
            "$ref": "#/components/schemas/Agorot"
          },
          "paid": {
            "$ref": "#/components/schemas/Agorot"
          },
          "open": {
            "$ref": "#/components/schemas/SignedAgorot"
          }
        },
        "required": [
          "documentId",
          "type",
          "number",
          "documentDate",
          "dueDate",
          "gross",
          "paid",
          "open"
        ]
      },
      "OpenDebtsReport": {
        "type": "object",
        "properties": {
          "meta": {
            "$ref": "#/components/schemas/ReportMeta"
          },
          "customers": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "customerId": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/Id"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "customerName": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 120
                },
                "invoiced": {
                  "$ref": "#/components/schemas/Agorot"
                },
                "credited": {
                  "$ref": "#/components/schemas/Agorot"
                },
                "received": {
                  "$ref": "#/components/schemas/Agorot"
                },
                "closedByHand": {
                  "$ref": "#/components/schemas/Agorot"
                },
                "balance": {
                  "$ref": "#/components/schemas/SignedAgorot"
                },
                "oldestOpenDate": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/LocalDate"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "documents": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/OpenDebtDocument"
                  }
                }
              },
              "required": [
                "customerId",
                "customerName",
                "invoiced",
                "credited",
                "received",
                "balance",
                "oldestOpenDate",
                "documents"
              ]
            }
          },
          "total": {
            "$ref": "#/components/schemas/SignedAgorot"
          }
        },
        "required": [
          "meta",
          "customers",
          "total"
        ]
      },
      "OpenFormatDocCode": {
        "type": "string",
        "enum": [
          "100",
          "200",
          "205",
          "210",
          "300",
          "305",
          "310",
          "320",
          "330",
          "340",
          "345",
          "400",
          "405",
          "410",
          "420",
          "500",
          "600",
          "610",
          "700",
          "710",
          "800",
          "810",
          "820",
          "830",
          "840",
          "900",
          "910"
        ]
      },
      "OriginalState": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "not_delivered",
              "delivered"
            ]
          },
          "deliveredAt": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Timestamp"
              },
              {
                "type": "null"
              }
            ]
          },
          "channel": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/DeliveryChannel"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "status",
          "deliveredAt",
          "channel"
        ]
      },
      "PaymentDemandTitle": {
        "type": "string",
        "enum": [
          "transaction_account",
          "payment_request",
          "transaction_invoice"
        ]
      },
      "PaymentInput": {
        "oneOf": [
          {
            "type": "object",
            "properties": {
              "method": {
                "type": "string",
                "const": "cash"
              },
              "amount": {
                "minimum": 1,
                "$ref": "#/components/schemas/MinorUnits"
              },
              "date": {
                "$ref": "#/components/schemas/LocalDate"
              }
            },
            "required": [
              "method",
              "amount",
              "date"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "method": {
                "type": "string",
                "const": "cheque"
              },
              "amount": {
                "minimum": 1,
                "$ref": "#/components/schemas/MinorUnits"
              },
              "date": {
                "$ref": "#/components/schemas/LocalDate"
              },
              "dueDate": {
                "$ref": "#/components/schemas/LocalDate"
              },
              "bankCode": {
                "type": "string",
                "pattern": "^\\d{1,10}$"
              },
              "branchCode": {
                "type": "string",
                "pattern": "^\\d{1,10}$"
              },
              "accountNumber": {
                "type": "string",
                "pattern": "^\\d{1,15}$"
              },
              "chequeNumber": {
                "type": "string",
                "pattern": "^\\d{1,10}$"
              },
              "crossedNonNegotiable": {
                "default": false,
                "type": "boolean"
              },
              "payeeNamed": {
                "default": true,
                "type": "boolean"
              },
              "endorsed": {
                "default": false,
                "type": "boolean"
              },
              "endorserName": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              },
              "endorserId": {
                "type": "string",
                "pattern": "^\\d{5,9}$"
              }
            },
            "required": [
              "method",
              "amount",
              "date",
              "dueDate",
              "bankCode",
              "branchCode",
              "accountNumber",
              "chequeNumber"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "method": {
                "type": "string",
                "const": "credit"
              },
              "amount": {
                "minimum": 1,
                "$ref": "#/components/schemas/MinorUnits"
              },
              "date": {
                "$ref": "#/components/schemas/LocalDate"
              },
              "dueDate": {
                "$ref": "#/components/schemas/LocalDate"
              },
              "acquirer": {
                "$ref": "#/components/schemas/CardAcquirer"
              },
              "brandName": {
                "type": "string",
                "maxLength": 20
              },
              "last4": {
                "type": "string",
                "pattern": "^\\d{4}$"
              },
              "dealType": {
                "default": "regular",
                "$ref": "#/components/schemas/CardDealType"
              },
              "installments": {
                "type": "integer",
                "minimum": 1,
                "maximum": 99
              },
              "customerOwnCard": {
                "default": false,
                "type": "boolean"
              }
            },
            "required": [
              "method",
              "amount",
              "date"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "method": {
                "type": "string",
                "const": "transfer"
              },
              "amount": {
                "minimum": 1,
                "$ref": "#/components/schemas/MinorUnits"
              },
              "date": {
                "$ref": "#/components/schemas/LocalDate"
              },
              "reference": {
                "type": "string",
                "maxLength": 40
              },
              "directFromCustomerAccount": {
                "default": false,
                "type": "boolean"
              },
              "toAccount": {
                "$ref": "#/components/schemas/TransferAccountInput"
              }
            },
            "required": [
              "method",
              "amount",
              "date"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "method": {
                "type": "string",
                "const": "bit"
              },
              "amount": {
                "minimum": 1,
                "$ref": "#/components/schemas/MinorUnits"
              },
              "date": {
                "$ref": "#/components/schemas/LocalDate"
              },
              "appName": {
                "type": "string",
                "maxLength": 30
              },
              "reference": {
                "type": "string",
                "maxLength": 40
              }
            },
            "required": [
              "method",
              "amount",
              "date"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "method": {
                "type": "string",
                "const": "voucher"
              },
              "amount": {
                "minimum": 1,
                "$ref": "#/components/schemas/MinorUnits"
              },
              "date": {
                "$ref": "#/components/schemas/LocalDate"
              },
              "description": {
                "type": "string",
                "maxLength": 60
              }
            },
            "required": [
              "method",
              "amount",
              "date"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "method": {
                "type": "string",
                "const": "exchange_slip"
              },
              "amount": {
                "minimum": 1,
                "$ref": "#/components/schemas/MinorUnits"
              },
              "date": {
                "$ref": "#/components/schemas/LocalDate"
              },
              "reference": {
                "type": "string",
                "maxLength": 40
              }
            },
            "required": [
              "method",
              "amount",
              "date"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "method": {
                "type": "string",
                "const": "promissory_note"
              },
              "amount": {
                "minimum": 1,
                "$ref": "#/components/schemas/MinorUnits"
              },
              "date": {
                "$ref": "#/components/schemas/LocalDate"
              },
              "dueDate": {
                "$ref": "#/components/schemas/LocalDate"
              },
              "reference": {
                "type": "string",
                "maxLength": 40
              }
            },
            "required": [
              "method",
              "amount",
              "date"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "method": {
                "type": "string",
                "const": "standing_order"
              },
              "amount": {
                "minimum": 1,
                "$ref": "#/components/schemas/MinorUnits"
              },
              "date": {
                "$ref": "#/components/schemas/LocalDate"
              },
              "reference": {
                "type": "string",
                "maxLength": 40
              }
            },
            "required": [
              "method",
              "amount",
              "date"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "method": {
                "type": "string",
                "const": "other"
              },
              "amount": {
                "minimum": 1,
                "$ref": "#/components/schemas/MinorUnits"
              },
              "date": {
                "$ref": "#/components/schemas/LocalDate"
              },
              "description": {
                "type": "string",
                "minLength": 1,
                "maxLength": 60
              }
            },
            "required": [
              "method",
              "amount",
              "date",
              "description"
            ],
            "additionalProperties": false
          }
        ]
      },
      "PaymentLineNo": {
        "type": "integer",
        "minimum": 1,
        "maximum": 100
      },
      "PaymentMethod": {
        "type": "string",
        "enum": [
          "cash",
          "cheque",
          "credit",
          "transfer",
          "bit",
          "voucher",
          "exchange_slip",
          "promissory_note",
          "standing_order",
          "other"
        ]
      },
      "Phone": {
        "type": "string",
        "pattern": "^\\+?\\d{7,15}$"
      },
      "PreSwitchDocumentNumber": {
        "type": "string",
        "pattern": "^[0-9A-Za-z](?:[0-9A-Za-z./-]{0,18}[0-9A-Za-z])?$"
      },
      "PreSwitchDocumentType": {
        "type": "string",
        "enum": [
          "tax_invoice",
          "tax_invoice_receipt"
        ]
      },
      "PrintedNotice": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string",
            "pattern": "^[a-z0-9_]{1,40}$"
          },
          "he": {
            "type": "string",
            "minLength": 1,
            "maxLength": 500
          },
          "en": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 500
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "code",
          "he",
          "en"
        ]
      },
      "ProfitAndLossReport": {
        "type": "object",
        "properties": {
          "meta": {
            "$ref": "#/components/schemas/ReportMeta"
          },
          "incomeNet": {
            "$ref": "#/components/schemas/SignedAgorot"
          },
          "expenses": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "category": {
                  "type": "string",
                  "maxLength": 40
                },
                "categoryName": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 60
                },
                "net": {
                  "$ref": "#/components/schemas/Agorot"
                }
              },
              "required": [
                "category",
                "categoryName",
                "net"
              ]
            }
          },
          "expensesNet": {
            "$ref": "#/components/schemas/Agorot"
          },
          "profit": {
            "$ref": "#/components/schemas/SignedAgorot"
          },
          "disclaimer": {
            "type": "string",
            "maxLength": 300
          }
        },
        "required": [
          "meta",
          "incomeNet",
          "expenses",
          "expensesNet",
          "profit",
          "disclaimer"
        ]
      },
      "PublicApiAllocation": {
        "type": "object",
        "properties": {
          "required": {
            "type": "boolean"
          },
          "number": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^\\d{9}$"
              },
              {
                "type": "null"
              }
            ],
            "x-tax-authority-data": true
          }
        },
        "required": [
          "required",
          "number"
        ]
      },
      "PublicApiAllocationApproval": {
        "type": "object",
        "properties": {
          "approvalNumber": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^\\d{9}$"
              },
              {
                "type": "null"
              }
            ],
            "x-tax-authority-data": true
          }
        },
        "required": [
          "approvalNumber"
        ]
      },
      "PublicApiBusiness": {
        "type": "object",
        "properties": {
          "id": {
            "$ref": "#/components/schemas/Id"
          },
          "legalName": {
            "type": "string",
            "minLength": 1,
            "maxLength": 120
          },
          "displayName": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              },
              {
                "type": "null"
              }
            ]
          },
          "dealerType": {
            "$ref": "#/components/schemas/DealerType"
          },
          "vatNumber": {
            "$ref": "#/components/schemas/VatNumber"
          },
          "companyNumber": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/VatNumber"
              },
              {
                "type": "null"
              }
            ]
          },
          "withholdingFileNumber": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^\\d{9}$"
              },
              {
                "type": "null"
              }
            ]
          },
          "address": {
            "$ref": "#/components/schemas/Address"
          },
          "phone": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Phone"
              },
              {
                "type": "null"
              }
            ]
          },
          "email": {
            "$ref": "#/components/schemas/Email"
          },
          "contactName": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              },
              {
                "type": "null"
              }
            ]
          },
          "website": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 200,
                "format": "uri"
              },
              {
                "type": "null"
              }
            ]
          },
          "legalNameEn": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              },
              {
                "type": "null"
              }
            ]
          },
          "addressEn": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 200
              },
              {
                "type": "null"
              }
            ]
          },
          "occupation": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "classification": {
                    "type": "string",
                    "const": "il-sic-2011"
                  },
                  "code": {
                    "anyOf": [
                      {
                        "type": "string",
                        "enum": [
                          "1010",
                          "1011",
                          "1020",
                          "1030",
                          "1040",
                          "1050",
                          "1061",
                          "1062",
                          "1070",
                          "1071",
                          "1072",
                          "1073",
                          "1074",
                          "1075",
                          "1079",
                          "1080",
                          "1101",
                          "1102",
                          "1103",
                          "1104",
                          "1200",
                          "1311",
                          "1312",
                          "1313",
                          "1391",
                          "1392",
                          "1393",
                          "1394",
                          "1399",
                          "1410",
                          "1411",
                          "1412",
                          "1420",
                          "1430",
                          "1511",
                          "1512",
                          "1520",
                          "1610",
                          "1621",
                          "1622",
                          "1623",
                          "1629",
                          "1701",
                          "1702",
                          "1709",
                          "1811",
                          "1812",
                          "1820",
                          "1910",
                          "1920",
                          "2011",
                          "2021",
                          "2030",
                          "2040",
                          "2050",
                          "2060",
                          "2070",
                          "2080",
                          "2100",
                          "2211",
                          "2219",
                          "2220",
                          "2230",
                          "2240",
                          "2250",
                          "2260",
                          "2270",
                          "2280",
                          "2310",
                          "2391",
                          "2392",
                          "2393",
                          "2394",
                          "2395",
                          "2396",
                          "2397",
                          "2398",
                          "2399",
                          "2410",
                          "2420",
                          "2431",
                          "2432",
                          "2511",
                          "2512",
                          "2513",
                          "2520",
                          "2591",
                          "2592",
                          "2593",
                          "2594",
                          "2595",
                          "2596",
                          "2599",
                          "2610",
                          "2621",
                          "2630",
                          "2640",
                          "2651",
                          "2652",
                          "2660",
                          "2670",
                          "2680",
                          "2711",
                          "2712",
                          "2713",
                          "2720",
                          "2731",
                          "2732",
                          "2733",
                          "2740",
                          "2750",
                          "2790",
                          "2811",
                          "2812",
                          "2813",
                          "2814",
                          "2815",
                          "2816",
                          "2817",
                          "2818",
                          "2819",
                          "2821",
                          "2822",
                          "2823",
                          "2824",
                          "2825",
                          "2826",
                          "2829",
                          "2910",
                          "2920",
                          "2930",
                          "3011",
                          "3012",
                          "3020",
                          "3030",
                          "3040",
                          "3091",
                          "3092",
                          "3099",
                          "3100",
                          "3211",
                          "3212",
                          "3220",
                          "3230",
                          "3240",
                          "3250",
                          "3290",
                          "3311",
                          "3312",
                          "3313",
                          "3314",
                          "3315",
                          "3319",
                          "3320",
                          "3400",
                          "3510",
                          "3511",
                          "3520",
                          "3530",
                          "3600",
                          "3700",
                          "3811",
                          "3812",
                          "3821",
                          "3822",
                          "3830",
                          "3900",
                          "4101",
                          "4102",
                          "4103",
                          "4104",
                          "4105",
                          "4210",
                          "4211",
                          "4212",
                          "4213",
                          "4220",
                          "4290",
                          "4311",
                          "4312",
                          "4323",
                          "4324",
                          "4325",
                          "4326",
                          "4327",
                          "4328",
                          "4329",
                          "4330",
                          "4331",
                          "4332",
                          "4333",
                          "4334",
                          "4335",
                          "4336",
                          "4337",
                          "4338",
                          "4392",
                          "4393",
                          "4394",
                          "4395",
                          "4396",
                          "4397",
                          "4398",
                          "4511",
                          "4512",
                          "4521",
                          "4522",
                          "4523",
                          "4524",
                          "4525",
                          "4526",
                          "4527",
                          "4531",
                          "4532",
                          "4533",
                          "4540",
                          "4610",
                          "4621",
                          "4622",
                          "4623",
                          "4631",
                          "4632",
                          "4633",
                          "4634",
                          "4635",
                          "4636",
                          "4640",
                          "4641",
                          "4642",
                          "4643",
                          "4644",
                          "4645",
                          "4646",
                          "4647",
                          "4648",
                          "4649",
                          "4651",
                          "4652",
                          "4653",
                          "4654",
                          "4655",
                          "4656",
                          "4657",
                          "4658",
                          "4661",
                          "4662",
                          "4664",
                          "4665",
                          "4666",
                          "4667",
                          "4669",
                          "4670",
                          "4671",
                          "4690",
                          "4711",
                          "4719",
                          "4722",
                          "4723",
                          "4724",
                          "4725",
                          "4726",
                          "4727",
                          "4728",
                          "4729",
                          "4730",
                          "4741",
                          "4742",
                          "4751",
                          "4752",
                          "4753",
                          "4754",
                          "4755",
                          "4756",
                          "4757",
                          "4758",
                          "4761",
                          "4762",
                          "4763",
                          "4764",
                          "4770",
                          "4771",
                          "4772",
                          "4773",
                          "4774",
                          "4775",
                          "4776",
                          "4777",
                          "4778",
                          "4779",
                          "4781",
                          "4782",
                          "4789",
                          "4791",
                          "4799",
                          "4911",
                          "4912",
                          "4921",
                          "4923",
                          "4924",
                          "4925",
                          "4926",
                          "4927",
                          "4928",
                          "4929",
                          "4930",
                          "5011",
                          "5012",
                          "5021",
                          "5022",
                          "5110",
                          "5120",
                          "5210",
                          "5211",
                          "5212",
                          "5213",
                          "5222",
                          "5223",
                          "5224",
                          "5225",
                          "5226",
                          "5227",
                          "5228",
                          "5229",
                          "5310",
                          "5320",
                          "5510",
                          "5511",
                          "5512",
                          "5513",
                          "5514",
                          "5520",
                          "5590",
                          "5610",
                          "5611",
                          "5621",
                          "5622",
                          "5629",
                          "5630",
                          "5631",
                          "5811",
                          "5812",
                          "5813",
                          "5819",
                          "5820",
                          "5911",
                          "5912",
                          "5913",
                          "5914",
                          "5920",
                          "6010",
                          "6020",
                          "6110",
                          "6120",
                          "6130",
                          "6190",
                          "6201",
                          "6202",
                          "6203",
                          "6209",
                          "6311",
                          "6312",
                          "6391",
                          "6399",
                          "6411",
                          "6419",
                          "6420",
                          "6430",
                          "6491",
                          "6492",
                          "6499",
                          "6511",
                          "6512",
                          "6520",
                          "6530",
                          "6611",
                          "6612",
                          "6619",
                          "6621",
                          "6622",
                          "6629",
                          "6630",
                          "6810",
                          "6820",
                          "6821",
                          "6910",
                          "6920",
                          "6921",
                          "6922",
                          "7010",
                          "7020",
                          "7110",
                          "7111",
                          "7120",
                          "7201",
                          "7210",
                          "7220",
                          "7310",
                          "7320",
                          "7410",
                          "7411",
                          "7412",
                          "7420",
                          "7490",
                          "7500",
                          "7710",
                          "7721",
                          "7722",
                          "7729",
                          "7730",
                          "7740",
                          "7810",
                          "7820",
                          "7830",
                          "7911",
                          "7912",
                          "7990",
                          "8010",
                          "8020",
                          "8030",
                          "8110",
                          "8121",
                          "8129",
                          "8130",
                          "8211",
                          "8219",
                          "8220",
                          "8230",
                          "8291",
                          "8292",
                          "8299",
                          "8310",
                          "8311",
                          "8312",
                          "8313",
                          "8323",
                          "8390",
                          "8411",
                          "8412",
                          "8413",
                          "8414",
                          "8421",
                          "8422",
                          "8423",
                          "8430",
                          "8450",
                          "8501",
                          "8510",
                          "8511",
                          "8512",
                          "8513",
                          "8520",
                          "8521",
                          "8522",
                          "8523",
                          "8524",
                          "8525",
                          "8526",
                          "8530",
                          "8531",
                          "8532",
                          "8533",
                          "8541",
                          "8542",
                          "8543",
                          "8550",
                          "8560",
                          "8571",
                          "8572",
                          "8573",
                          "8574",
                          "8575",
                          "8576",
                          "8580",
                          "8610",
                          "8611",
                          "8612",
                          "8620",
                          "8621",
                          "8622",
                          "8623",
                          "8690",
                          "8691",
                          "8692",
                          "8710",
                          "8720",
                          "8721",
                          "8722",
                          "8730",
                          "8790",
                          "8810",
                          "8820",
                          "8890",
                          "8891",
                          "9000",
                          "9101",
                          "9102",
                          "9103",
                          "9200",
                          "9311",
                          "9312",
                          "9313",
                          "9319",
                          "9321",
                          "9328",
                          "9329",
                          "9411",
                          "9412",
                          "9420",
                          "9431",
                          "9432",
                          "9433",
                          "9434",
                          "9440",
                          "9492",
                          "9499",
                          "9511",
                          "9512",
                          "9521",
                          "9522",
                          "9523",
                          "9524",
                          "9529",
                          "9601",
                          "9602",
                          "9603",
                          "9609",
                          "9700",
                          "9810",
                          "9820",
                          "9900",
                          "0111",
                          "0112",
                          "0113",
                          "0114",
                          "0115",
                          "0116",
                          "0117",
                          "0118",
                          "0119",
                          "0120",
                          "0121",
                          "0122",
                          "0123",
                          "0124",
                          "0125",
                          "0126",
                          "0127",
                          "0128",
                          "0129",
                          "0130",
                          "0150",
                          "0151",
                          "0161",
                          "0163",
                          "0164",
                          "0210",
                          "0220",
                          "0230",
                          "0240",
                          "0311",
                          "0312",
                          "0321",
                          "0322",
                          "0323",
                          "0324",
                          "0401",
                          "0402",
                          "0403",
                          "0404",
                          "0405",
                          "0406",
                          "0407",
                          "0408",
                          "0409",
                          "0410",
                          "0420",
                          "0510",
                          "0520",
                          "0610",
                          "0620",
                          "0710",
                          "0721",
                          "0729",
                          "0810",
                          "0891",
                          "0892",
                          "0893",
                          "0894",
                          "0899",
                          "0910",
                          "0990"
                        ]
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "otherText": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 2,
                        "maxLength": 80
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "declined": {
                    "type": "boolean"
                  },
                  "label": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "setAt": {
                    "$ref": "#/components/schemas/Timestamp"
                  }
                },
                "required": [
                  "classification",
                  "code",
                  "otherText",
                  "declined",
                  "setAt"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "logo": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/StoredFile"
              },
              {
                "type": "null"
              }
            ]
          },
          "settings": {
            "$ref": "#/components/schemas/PublicApiBusinessSettings"
          },
          "tax": {
            "$ref": "#/components/schemas/BusinessTaxProfile"
          },
          "signatureMode": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/SignatureMode"
              },
              {
                "type": "null"
              }
            ]
          },
          "compliance": {
            "$ref": "#/components/schemas/BusinessComplianceState"
          },
          "status": {
            "$ref": "#/components/schemas/BusinessStatus"
          },
          "closedAt": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Timestamp"
              },
              {
                "type": "null"
              }
            ]
          },
          "tenantKind": {
            "$ref": "#/components/schemas/TenantKind"
          },
          "isDemo": {
            "type": "boolean"
          },
          "createdAt": {
            "$ref": "#/components/schemas/Timestamp"
          }
        },
        "required": [
          "id",
          "legalName",
          "displayName",
          "dealerType",
          "vatNumber",
          "companyNumber",
          "withholdingFileNumber",
          "address",
          "phone",
          "email",
          "contactName",
          "website",
          "logo",
          "settings",
          "tax",
          "signatureMode",
          "compliance",
          "status",
          "closedAt",
          "tenantKind",
          "isDemo",
          "createdAt"
        ]
      },
      "PublicApiBusinessSettings": {
        "type": "object",
        "properties": {
          "defaultLanguage": {
            "$ref": "#/components/schemas/DocumentLanguage"
          },
          "alwaysRequestAllocation": {
            "type": "boolean"
          },
          "sendCopyToSelf": {
            "type": "boolean"
          },
          "replyToEmail": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Email"
              },
              {
                "type": "null"
              }
            ]
          },
          "defaultPaymentTermsDays": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": 0,
                "maximum": 365
              },
              {
                "type": "null"
              }
            ]
          },
          "defaultNotes": {
            "type": "object",
            "propertyNames": {
              "$ref": "#/components/schemas/DocumentType"
            },
            "additionalProperties": {
              "type": "string",
              "maxLength": 1000
            }
          },
          "footerText": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 500
              },
              {
                "type": "null"
              }
            ]
          },
          "exemptCeilingAlert": {
            "type": "boolean"
          },
          "footerTextEn": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 500
              },
              {
                "type": "null"
              }
            ]
          },
          "tagline": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              },
              {
                "type": "null"
              }
            ]
          },
          "taglineEn": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              },
              {
                "type": "null"
              }
            ]
          },
          "look": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/DocumentLook"
              },
              {
                "type": "null"
              }
            ]
          },
          "printPhone": {
            "type": "boolean"
          },
          "ownerCopyOfIssued": {
            "type": "boolean"
          },
          "ownerCopyOfAutomatic": {
            "type": "boolean"
          },
          "generalNotes": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 1000
              },
              {
                "type": "null"
              }
            ]
          },
          "generalNotesEn": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 1000
              },
              {
                "type": "null"
              }
            ]
          },
          "defaultNotesEn": {
            "type": "object",
            "propertyNames": {
              "$ref": "#/components/schemas/DocumentType"
            },
            "additionalProperties": {
              "type": "string",
              "maxLength": 1000
            }
          },
          "defaultNotesReplaceGeneral": {
            "maxItems": 9,
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DocumentType"
            }
          },
          "paymentTerms": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "enum": [
                      "net_days",
                      "end_of_month_plus"
                    ]
                  },
                  "days": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 365
                  }
                },
                "required": [
                  "kind",
                  "days"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "defaultPaymentMethod": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/PaymentMethod"
              },
              {
                "type": "null"
              }
            ]
          },
          "pricesIncludeVat": {
            "type": "boolean"
          },
          "defaultEmailMessage": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 300
              },
              {
                "type": "null"
              }
            ]
          },
          "defaultCurrency": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/CurrencyCode"
              },
              {
                "type": "null"
              }
            ]
          },
          "roundToShekel": {
            "type": "boolean"
          }
        },
        "required": [
          "defaultLanguage",
          "alwaysRequestAllocation",
          "sendCopyToSelf",
          "replyToEmail",
          "defaultPaymentTermsDays",
          "defaultNotes",
          "footerText",
          "exemptCeilingAlert"
        ]
      },
      "PublicApiBusinessSnapshot": {
        "type": "object",
        "properties": {
          "businessId": {
            "$ref": "#/components/schemas/Id"
          },
          "legalName": {
            "type": "string",
            "minLength": 1,
            "maxLength": 120
          },
          "displayName": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              },
              {
                "type": "null"
              }
            ]
          },
          "dealerType": {
            "$ref": "#/components/schemas/DealerType"
          },
          "vatNumber": {
            "$ref": "#/components/schemas/VatNumber"
          },
          "address": {
            "$ref": "#/components/schemas/Address"
          },
          "phone": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Phone"
              },
              {
                "type": "null"
              }
            ]
          },
          "email": {
            "$ref": "#/components/schemas/Email"
          },
          "logo": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/StoredFile"
              },
              {
                "type": "null"
              }
            ]
          },
          "companyNumber": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/VatNumber"
              },
              {
                "type": "null"
              }
            ]
          },
          "nameEn": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              },
              {
                "type": "null"
              }
            ]
          },
          "addressEn": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 200
              },
              {
                "type": "null"
              }
            ]
          },
          "tagline": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              },
              {
                "type": "null"
              }
            ]
          },
          "taglineEn": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              },
              {
                "type": "null"
              }
            ]
          },
          "footerText": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 500
              },
              {
                "type": "null"
              }
            ]
          },
          "footerTextEn": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 500
              },
              {
                "type": "null"
              }
            ]
          },
          "look": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/DocumentLook"
              },
              {
                "type": "null"
              }
            ]
          },
          "website": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 200,
                "format": "uri"
              },
              {
                "type": "null"
              }
            ]
          },
          "printPhone": {
            "type": "boolean"
          }
        },
        "required": [
          "businessId",
          "legalName",
          "displayName",
          "dealerType",
          "vatNumber",
          "address",
          "phone",
          "email",
          "logo"
        ]
      },
      "PublicApiCreateRenditionRequest": {
        "type": "object",
        "properties": {
          "purpose": {
            "type": "string",
            "enum": [
              "business_copy"
            ]
          },
          "language": {
            "$ref": "#/components/schemas/DocumentLanguage"
          }
        },
        "required": [
          "purpose"
        ],
        "additionalProperties": false
      },
      "PublicApiCreateReportExportRequest": {
        "type": "object",
        "properties": {
          "report": {
            "$ref": "#/components/schemas/PublicApiReportKind"
          },
          "format": {
            "$ref": "#/components/schemas/ReportExportFormat"
          },
          "from": {
            "$ref": "#/components/schemas/LocalDate"
          },
          "to": {
            "$ref": "#/components/schemas/LocalDate"
          },
          "asOf": {
            "$ref": "#/components/schemas/LocalDate"
          },
          "documentIds": {
            "minItems": 1,
            "maxItems": 10000,
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Id"
            }
          },
          "filters": {
            "$ref": "#/components/schemas/PublicApiDocumentListFilters"
          },
          "customerId": {
            "$ref": "#/components/schemas/Id"
          },
          "documentType": {
            "$ref": "#/components/schemas/DocumentType"
          }
        },
        "required": [
          "report",
          "format"
        ],
        "additionalProperties": false
      },
      "PublicApiDocument": {
        "oneOf": [
          {
            "$ref": "#/components/schemas/PublicApiDraftDocument"
          },
          {
            "$ref": "#/components/schemas/PublicApiIssuedDocument"
          }
        ]
      },
      "PublicApiDocumentCancellation": {
        "type": "object",
        "properties": {
          "cancelledAt": {
            "$ref": "#/components/schemas/Timestamp"
          },
          "cancelledByUserId": {
            "$ref": "#/components/schemas/Id"
          },
          "confirmedNotReportedToVat": {
            "type": "boolean"
          }
        },
        "required": [
          "cancelledAt",
          "cancelledByUserId",
          "confirmedNotReportedToVat"
        ]
      },
      "PublicApiDocumentCollectionView": {
        "type": "object",
        "properties": {
          "asOf": {
            "$ref": "#/components/schemas/LocalDate"
          },
          "collection": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "documentId": {
                    "$ref": "#/components/schemas/Id"
                  },
                  "type": {
                    "$ref": "#/components/schemas/DocumentType"
                  },
                  "variant": {
                    "$ref": "#/components/schemas/DocumentVariant"
                  },
                  "titleVariant": {
                    "anyOf": [
                      {
                        "$ref": "#/components/schemas/PaymentDemandTitle"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "number": {
                    "$ref": "#/components/schemas/DocumentNumber"
                  },
                  "documentDate": {
                    "$ref": "#/components/schemas/LocalDate"
                  },
                  "dueDate": {
                    "anyOf": [
                      {
                        "$ref": "#/components/schemas/LocalDate"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "customerId": {
                    "anyOf": [
                      {
                        "$ref": "#/components/schemas/Id"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "customerName": {
                    "type": "string",
                    "maxLength": 120
                  },
                  "currency": {
                    "$ref": "#/components/schemas/CurrencyCode"
                  },
                  "gross": {
                    "$ref": "#/components/schemas/Agorot"
                  },
                  "credited": {
                    "$ref": "#/components/schemas/Agorot"
                  },
                  "paid": {
                    "$ref": "#/components/schemas/Agorot"
                  },
                  "open": {
                    "$ref": "#/components/schemas/Agorot"
                  },
                  "status": {
                    "type": "string",
                    "enum": [
                      "open",
                      "partly_paid",
                      "paid",
                      "credited",
                      "followed_up",
                      "closed_by_hand",
                      "cancelled"
                    ]
                  },
                  "overdue": {
                    "type": "boolean"
                  },
                  "daysOverdue": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "closedByHand": {
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "reason": {
                            "type": "string",
                            "enum": [
                              "customer_will_not_pay",
                              "settled_otherwise",
                              "other"
                            ]
                          },
                          "note": {
                            "anyOf": [
                              {
                                "type": "string",
                                "maxLength": 200
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "closedAt": {
                            "$ref": "#/components/schemas/Timestamp"
                          },
                          "closedByName": {
                            "anyOf": [
                              {
                                "type": "string",
                                "maxLength": 120
                              },
                              {
                                "type": "null"
                              }
                            ]
                          }
                        },
                        "required": [
                          "reason",
                          "note",
                          "closedAt",
                          "closedByName"
                        ]
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "nextReminderOn": {
                    "anyOf": [
                      {
                        "$ref": "#/components/schemas/LocalDate"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "documentId",
                  "type",
                  "variant",
                  "titleVariant",
                  "number",
                  "documentDate",
                  "dueDate",
                  "customerId",
                  "customerName",
                  "currency",
                  "gross",
                  "credited",
                  "paid",
                  "open",
                  "status",
                  "overdue",
                  "daysOverdue",
                  "closedByHand",
                  "nextReminderOn"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "closable": {
            "type": "boolean"
          },
          "reopenable": {
            "type": "boolean"
          },
          "reminders": {
            "type": "object",
            "properties": {
              "eligible": {
                "type": "boolean"
              },
              "note": {
                "anyOf": [
                  {
                    "type": "string",
                    "maxLength": 300
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "mode": {
                "type": "string",
                "enum": [
                  "business_default",
                  "custom",
                  "off"
                ]
              },
              "rules": {
                "anyOf": [
                  {
                    "type": "object",
                    "properties": {
                      "before": {
                        "anyOf": [
                          {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 14
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "after": {
                        "maxItems": 3,
                        "type": "array",
                        "items": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 90
                        }
                      }
                    },
                    "required": [
                      "before",
                      "after"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "personalNote": {
                "anyOf": [
                  {
                    "type": "string",
                    "maxLength": 500
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "recipientsFrom": {
                "type": "string",
                "enum": [
                  "customer",
                  "document"
                ]
              },
              "recipients": {
                "maxItems": 5,
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/Email"
                }
              },
              "settingsFrom": {
                "anyOf": [
                  {
                    "$ref": "#/components/schemas/Timestamp"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "upcoming": {
                "maxItems": 4,
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "key": {
                      "type": "string",
                      "pattern": "^(?:(?:before|after):\\d{1,2}|manual)$"
                    },
                    "kind": {
                      "type": "string",
                      "enum": [
                        "before",
                        "after"
                      ]
                    },
                    "days": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 90
                    },
                    "on": {
                      "$ref": "#/components/schemas/LocalDate"
                    },
                    "scheduledOn": {
                      "$ref": "#/components/schemas/LocalDate"
                    },
                    "moved": {
                      "type": "boolean"
                    },
                    "restDay": {
                      "anyOf": [
                        {
                          "type": "string",
                          "maxLength": 40
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "key",
                    "kind",
                    "days",
                    "on",
                    "scheduledOn",
                    "moved",
                    "restDay"
                  ]
                }
              },
              "history": {
                "maxItems": 200,
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/PublicApiReminderRecord"
                }
              }
            },
            "required": [
              "eligible",
              "note",
              "mode",
              "rules",
              "personalNote",
              "recipientsFrom",
              "recipients",
              "settingsFrom",
              "upcoming",
              "history"
            ]
          }
        },
        "required": [
          "asOf",
          "collection",
          "closable",
          "reopenable",
          "reminders"
        ]
      },
      "PublicApiDocumentDraftInput": {
        "type": "object",
        "properties": {
          "id": {
            "$ref": "#/components/schemas/Id"
          },
          "type": {
            "$ref": "#/components/schemas/DocumentType"
          },
          "variant": {
            "default": "standard",
            "$ref": "#/components/schemas/DocumentVariant"
          },
          "titleVariant": {
            "$ref": "#/components/schemas/PaymentDemandTitle"
          },
          "language": {
            "$ref": "#/components/schemas/DocumentLanguage"
          },
          "currency": {
            "default": "ILS",
            "$ref": "#/components/schemas/CurrencyCode"
          },
          "fx": {
            "type": "object",
            "properties": {
              "rate": {
                "$ref": "#/components/schemas/ExchangeRate"
              },
              "rateDate": {
                "$ref": "#/components/schemas/LocalDate"
              },
              "source": {
                "$ref": "#/components/schemas/FxSource"
              }
            },
            "required": [
              "rate",
              "rateDate",
              "source"
            ],
            "additionalProperties": false
          },
          "pricesIncludeVat": {
            "default": false,
            "type": "boolean"
          },
          "documentDate": {
            "$ref": "#/components/schemas/LocalDate"
          },
          "dueDate": {
            "$ref": "#/components/schemas/LocalDate"
          },
          "valueDate": {
            "$ref": "#/components/schemas/LocalDate"
          },
          "validUntil": {
            "$ref": "#/components/schemas/LocalDate"
          },
          "exitTime": {
            "$ref": "#/components/schemas/LocalTime"
          },
          "customerId": {
            "$ref": "#/components/schemas/Id"
          },
          "oneOffCustomer": {
            "$ref": "#/components/schemas/OneOffCustomerInput"
          },
          "subject": {
            "type": "string",
            "maxLength": 200
          },
          "lines": {
            "default": [],
            "maxItems": 400,
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DocumentLineInput"
            }
          },
          "documentDiscount": {
            "default": 0,
            "$ref": "#/components/schemas/MinorUnits"
          },
          "payments": {
            "default": [],
            "maxItems": 100,
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PaymentInput"
            }
          },
          "withholding": {
            "default": 0,
            "$ref": "#/components/schemas/MinorUnits"
          },
          "nationalInsurance": {
            "default": 0,
            "$ref": "#/components/schemas/MinorUnits"
          },
          "creditReason": {
            "type": "object",
            "properties": {
              "code": {
                "$ref": "#/components/schemas/CreditReasonCode"
              },
              "text": {
                "type": "string",
                "minLength": 1,
                "maxLength": 300
              }
            },
            "required": [
              "code",
              "text"
            ],
            "additionalProperties": false
          },
          "refund": {
            "$ref": "#/components/schemas/CreditRefundInput"
          },
          "deposit": {
            "$ref": "#/components/schemas/DepositDetailsInput"
          },
          "receiptDetailLines": {
            "default": [],
            "maxItems": 100,
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ReceiptDetailLineInput"
            }
          },
          "notes": {
            "type": "string",
            "maxLength": 2000
          },
          "internalNotes": {
            "type": "string",
            "maxLength": 2000
          },
          "references": {
            "default": [],
            "maxItems": 50,
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DocumentReferenceInput"
            }
          }
        },
        "required": [
          "type"
        ],
        "additionalProperties": false
      },
      "PublicApiDocumentListFilters": {
        "type": "object",
        "properties": {
          "type": {
            "$ref": "#/components/schemas/DocumentType"
          },
          "variant": {
            "$ref": "#/components/schemas/DocumentVariant"
          },
          "status": {
            "$ref": "#/components/schemas/DocumentStatus"
          },
          "customerId": {
            "$ref": "#/components/schemas/Id"
          },
          "from": {
            "$ref": "#/components/schemas/LocalDate"
          },
          "to": {
            "$ref": "#/components/schemas/LocalDate"
          },
          "q": {
            "type": "string",
            "maxLength": 100
          },
          "amountFrom": {
            "type": "integer",
            "minimum": 0,
            "maximum": 99999999999999
          },
          "amountTo": {
            "type": "integer",
            "minimum": 0,
            "maximum": 99999999999999
          },
          "paymentMethod": {
            "$ref": "#/components/schemas/PaymentMethod"
          },
          "cancelled": {
            "type": "string",
            "enum": [
              "only",
              "exclude"
            ]
          }
        },
        "additionalProperties": false
      },
      "PublicApiDocumentPage": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PublicApiDocumentSummary"
            }
          },
          "nextCursor": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 512
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "items",
          "nextCursor"
        ]
      },
      "PublicApiDocumentSearchPage": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PublicApiDocumentSummary"
            }
          },
          "nextCursor": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 512
              },
              {
                "type": "null"
              }
            ]
          },
          "total": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": 0,
                "maximum": 10000
              },
              {
                "type": "null"
              }
            ]
          },
          "totalCapped": {
            "type": "boolean"
          }
        },
        "required": [
          "items",
          "nextCursor",
          "total",
          "totalCapped"
        ]
      },
      "PublicApiDocumentSummary": {
        "type": "object",
        "properties": {
          "id": {
            "$ref": "#/components/schemas/Id"
          },
          "type": {
            "$ref": "#/components/schemas/DocumentType"
          },
          "variant": {
            "$ref": "#/components/schemas/DocumentVariant"
          },
          "titleVariant": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/PaymentDemandTitle"
              },
              {
                "type": "null"
              }
            ]
          },
          "status": {
            "$ref": "#/components/schemas/DocumentStatus"
          },
          "number": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/DocumentNumber"
              },
              {
                "type": "null"
              }
            ]
          },
          "seriesPrefix": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/SeriesPrefix"
              },
              {
                "type": "null"
              }
            ]
          },
          "documentDate": {
            "$ref": "#/components/schemas/LocalDate"
          },
          "customerName": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              },
              {
                "type": "null"
              }
            ]
          },
          "currency": {
            "$ref": "#/components/schemas/CurrencyCode"
          },
          "gross": {
            "$ref": "#/components/schemas/Agorot"
          },
          "originalDelivered": {
            "type": "boolean"
          },
          "cancelled": {
            "type": "boolean"
          },
          "isDemo": {
            "type": "boolean"
          },
          "issueRequested": {
            "type": "boolean"
          },
          "issuedAt": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Timestamp"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "type",
          "variant",
          "titleVariant",
          "status",
          "number",
          "seriesPrefix",
          "documentDate",
          "customerName",
          "currency",
          "gross",
          "originalDelivered",
          "cancelled",
          "isDemo",
          "issueRequested",
          "issuedAt"
        ]
      },
      "PublicApiDraftDocument": {
        "type": "object",
        "properties": {
          "id": {
            "$ref": "#/components/schemas/Id"
          },
          "businessId": {
            "$ref": "#/components/schemas/Id"
          },
          "type": {
            "$ref": "#/components/schemas/DocumentType"
          },
          "variant": {
            "$ref": "#/components/schemas/DocumentVariant"
          },
          "titleVariant": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/PaymentDemandTitle"
              },
              {
                "type": "null"
              }
            ]
          },
          "series": {
            "type": "string",
            "minLength": 1,
            "maxLength": 20
          },
          "seriesPrefix": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/SeriesPrefix"
              },
              {
                "type": "null"
              }
            ]
          },
          "language": {
            "$ref": "#/components/schemas/DocumentLanguage"
          },
          "currency": {
            "$ref": "#/components/schemas/CurrencyCode"
          },
          "foreign": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/ForeignCurrency"
              },
              {
                "type": "null"
              }
            ]
          },
          "pricesIncludeVat": {
            "type": "boolean"
          },
          "documentDate": {
            "$ref": "#/components/schemas/LocalDate"
          },
          "dueDate": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/LocalDate"
              },
              {
                "type": "null"
              }
            ]
          },
          "valueDate": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/LocalDate"
              },
              {
                "type": "null"
              }
            ]
          },
          "validUntil": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/LocalDate"
              },
              {
                "type": "null"
              }
            ]
          },
          "exitTime": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/LocalTime"
              },
              {
                "type": "null"
              }
            ]
          },
          "customerId": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Id"
              },
              {
                "type": "null"
              }
            ]
          },
          "subject": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 200
              },
              {
                "type": "null"
              }
            ]
          },
          "lines": {
            "maxItems": 400,
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DocumentLine"
            }
          },
          "payments": {
            "maxItems": 100,
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PublicApiPayment"
            }
          },
          "totals": {
            "$ref": "#/components/schemas/DocumentTotals"
          },
          "vatBreakdown": {
            "maxItems": 10,
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/VatBreakdownRow"
            }
          },
          "creditReason": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/CreditReason"
              },
              {
                "type": "null"
              }
            ]
          },
          "selfInvoice": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/PublicApiSelfInvoiceDetails"
              },
              {
                "type": "null"
              }
            ]
          },
          "deposit": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/DepositDetails"
              },
              {
                "type": "null"
              }
            ]
          },
          "receiptDetailLines": {
            "maxItems": 100,
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ReceiptDetailLine"
            }
          },
          "refund": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/CreditRefund"
              },
              {
                "type": "null"
              }
            ]
          },
          "notes": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 2000
              },
              {
                "type": "null"
              }
            ]
          },
          "internalNotes": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 2000
              },
              {
                "type": "null"
              }
            ]
          },
          "references": {
            "maxItems": 50,
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DocumentReference"
            }
          },
          "createdByUserId": {
            "$ref": "#/components/schemas/Id"
          },
          "createdAt": {
            "$ref": "#/components/schemas/Timestamp"
          },
          "updatedAt": {
            "$ref": "#/components/schemas/Timestamp"
          },
          "status": {
            "type": "string",
            "const": "draft"
          },
          "openFormatCode": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/OpenFormatDocCode"
              },
              {
                "type": "null"
              }
            ]
          },
          "number": {
            "type": "null"
          },
          "issuedAt": {
            "type": "null"
          },
          "customer": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/CustomerPreview"
              },
              {
                "type": "null"
              }
            ]
          },
          "issueRequestedAt": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Timestamp"
              },
              {
                "type": "null"
              }
            ]
          },
          "isDemo": {
            "type": "boolean"
          },
          "issues": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "path": {
                  "type": "array",
                  "items": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "integer",
                        "minimum": -9007199254740991,
                        "maximum": 9007199254740991
                      }
                    ]
                  }
                },
                "code": {
                  "type": "string",
                  "maxLength": 64
                },
                "message": {
                  "type": "string",
                  "maxLength": 500
                },
                "severity": {
                  "type": "string",
                  "enum": [
                    "error",
                    "warning"
                  ]
                }
              },
              "required": [
                "path",
                "code",
                "message",
                "severity"
              ]
            }
          }
        },
        "required": [
          "id",
          "businessId",
          "type",
          "titleVariant",
          "series",
          "seriesPrefix",
          "language",
          "currency",
          "foreign",
          "pricesIncludeVat",
          "documentDate",
          "dueDate",
          "valueDate",
          "exitTime",
          "customerId",
          "subject",
          "lines",
          "payments",
          "totals",
          "vatBreakdown",
          "creditReason",
          "notes",
          "internalNotes",
          "references",
          "createdByUserId",
          "createdAt",
          "updatedAt",
          "status",
          "openFormatCode",
          "number",
          "issuedAt",
          "customer",
          "issueRequestedAt"
        ]
      },
      "PublicApiExpense": {
        "type": "object",
        "properties": {
          "id": {
            "$ref": "#/components/schemas/Id"
          },
          "businessId": {
            "$ref": "#/components/schemas/Id"
          },
          "kind": {
            "$ref": "#/components/schemas/ExpenseKind"
          },
          "supplier": {
            "$ref": "#/components/schemas/ExpenseSupplier"
          },
          "supplierCode": {
            "$ref": "#/components/schemas/CustomerCode"
          },
          "supplierDocumentNumber": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 20
              },
              {
                "type": "null"
              }
            ]
          },
          "documentDate": {
            "$ref": "#/components/schemas/LocalDate"
          },
          "category": {
            "$ref": "#/components/schemas/ExpenseCategory"
          },
          "inputClass": {
            "$ref": "#/components/schemas/ExpenseInputClass"
          },
          "description": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 500
              },
              {
                "type": "null"
              }
            ]
          },
          "net": {
            "$ref": "#/components/schemas/Agorot"
          },
          "vat": {
            "$ref": "#/components/schemas/Agorot"
          },
          "gross": {
            "$ref": "#/components/schemas/Agorot"
          },
          "deductibleVat": {
            "$ref": "#/components/schemas/Agorot"
          },
          "supplierAllocationNumber": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/AllocationNumber"
              },
              {
                "type": "null"
              }
            ]
          },
          "paymentMethod": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/PaymentMethod"
              },
              {
                "type": "null"
              }
            ]
          },
          "paidOn": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/LocalDate"
              },
              {
                "type": "null"
              }
            ]
          },
          "attachments": {
            "maxItems": 10,
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ExpenseAttachment"
            }
          },
          "receivedAsFile": {
            "type": "boolean"
          },
          "fileChecks": {
            "maxItems": 10,
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ReceivedFileCheck"
            }
          },
          "vatTreatment": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/ExpenseVatTreatment"
              },
              {
                "type": "null"
              }
            ]
          },
          "foreign": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/ExpenseForeignAmount"
              },
              {
                "type": "null"
              }
            ]
          },
          "foreignSupplier": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/ExpenseForeignSupplier"
              },
              {
                "type": "null"
              }
            ]
          },
          "selfInvoice": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/ExpenseSelfInvoiceLink"
              },
              {
                "type": "null"
              }
            ]
          },
          "origin": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/PublicApiExpenseOrigin"
              },
              {
                "type": "null"
              }
            ]
          },
          "openFormatCode": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "700",
                  "710"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "exportedInRunId": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Id"
              },
              {
                "type": "null"
              }
            ]
          },
          "lockedAt": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Timestamp"
              },
              {
                "type": "null"
              }
            ]
          },
          "createdByUserId": {
            "$ref": "#/components/schemas/Id"
          },
          "createdAt": {
            "$ref": "#/components/schemas/Timestamp"
          },
          "updatedAt": {
            "$ref": "#/components/schemas/Timestamp"
          }
        },
        "required": [
          "id",
          "businessId",
          "kind",
          "supplier",
          "supplierCode",
          "supplierDocumentNumber",
          "documentDate",
          "category",
          "inputClass",
          "description",
          "net",
          "vat",
          "gross",
          "deductibleVat",
          "supplierAllocationNumber",
          "paymentMethod",
          "paidOn",
          "attachments",
          "openFormatCode",
          "exportedInRunId",
          "lockedAt",
          "createdByUserId",
          "createdAt",
          "updatedAt"
        ]
      },
      "PublicApiExpenseOrigin": {
        "type": "object",
        "properties": {
          "source": {
            "$ref": "#/components/schemas/ExpenseSource"
          },
          "how": {
            "$ref": "#/components/schemas/ExpenseRecordedHow"
          }
        },
        "required": [
          "source",
          "how"
        ]
      },
      "PublicApiExpensePage": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PublicApiExpense"
            }
          },
          "nextCursor": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 512
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "items",
          "nextCursor"
        ]
      },
      "PublicApiIssueDocumentRequest": {
        "type": "object",
        "properties": {
          "expectedGross": {
            "$ref": "#/components/schemas/Agorot"
          },
          "documentDate": {
            "$ref": "#/components/schemas/LocalDate"
          },
          "mode": {
            "type": "string",
            "const": "real"
          },
          "requestAllocation": {
            "type": "boolean"
          }
        },
        "required": [
          "expectedGross",
          "documentDate"
        ],
        "additionalProperties": false
      },
      "PublicApiIssueDocumentResult": {
        "type": "object",
        "properties": {
          "document": {
            "$ref": "#/components/schemas/PublicApiIssuedDocument"
          },
          "warnings": {
            "maxItems": 50,
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/FieldError"
            }
          }
        },
        "required": [
          "document",
          "warnings"
        ]
      },
      "PublicApiIssuedDocument": {
        "type": "object",
        "properties": {
          "id": {
            "$ref": "#/components/schemas/Id"
          },
          "businessId": {
            "$ref": "#/components/schemas/Id"
          },
          "type": {
            "$ref": "#/components/schemas/DocumentType"
          },
          "variant": {
            "$ref": "#/components/schemas/DocumentVariant"
          },
          "titleVariant": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/PaymentDemandTitle"
              },
              {
                "type": "null"
              }
            ]
          },
          "series": {
            "type": "string",
            "minLength": 1,
            "maxLength": 20
          },
          "seriesPrefix": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/SeriesPrefix"
              },
              {
                "type": "null"
              }
            ]
          },
          "language": {
            "$ref": "#/components/schemas/DocumentLanguage"
          },
          "currency": {
            "$ref": "#/components/schemas/CurrencyCode"
          },
          "foreign": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/ForeignCurrency"
              },
              {
                "type": "null"
              }
            ]
          },
          "pricesIncludeVat": {
            "type": "boolean"
          },
          "documentDate": {
            "$ref": "#/components/schemas/LocalDate"
          },
          "dueDate": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/LocalDate"
              },
              {
                "type": "null"
              }
            ]
          },
          "valueDate": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/LocalDate"
              },
              {
                "type": "null"
              }
            ]
          },
          "validUntil": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/LocalDate"
              },
              {
                "type": "null"
              }
            ]
          },
          "exitTime": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/LocalTime"
              },
              {
                "type": "null"
              }
            ]
          },
          "customerId": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Id"
              },
              {
                "type": "null"
              }
            ]
          },
          "subject": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 200
              },
              {
                "type": "null"
              }
            ]
          },
          "lines": {
            "maxItems": 400,
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DocumentLine"
            }
          },
          "payments": {
            "maxItems": 100,
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PublicApiPayment"
            }
          },
          "totals": {
            "$ref": "#/components/schemas/DocumentTotals"
          },
          "vatBreakdown": {
            "maxItems": 10,
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/VatBreakdownRow"
            }
          },
          "creditReason": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/CreditReason"
              },
              {
                "type": "null"
              }
            ]
          },
          "selfInvoice": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/PublicApiSelfInvoiceDetails"
              },
              {
                "type": "null"
              }
            ]
          },
          "deposit": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/DepositDetails"
              },
              {
                "type": "null"
              }
            ]
          },
          "receiptDetailLines": {
            "maxItems": 100,
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ReceiptDetailLine"
            }
          },
          "refund": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/CreditRefund"
              },
              {
                "type": "null"
              }
            ]
          },
          "notes": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 2000
              },
              {
                "type": "null"
              }
            ]
          },
          "internalNotes": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 2000
              },
              {
                "type": "null"
              }
            ]
          },
          "references": {
            "maxItems": 50,
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DocumentReference"
            }
          },
          "createdByUserId": {
            "$ref": "#/components/schemas/Id"
          },
          "createdAt": {
            "$ref": "#/components/schemas/Timestamp"
          },
          "status": {
            "type": "string",
            "const": "issued"
          },
          "openFormatCode": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/OpenFormatDocCode"
              },
              {
                "type": "null"
              }
            ]
          },
          "number": {
            "$ref": "#/components/schemas/DocumentNumber"
          },
          "issuedAt": {
            "$ref": "#/components/schemas/Timestamp"
          },
          "issuedByUserId": {
            "$ref": "#/components/schemas/Id"
          },
          "issuedByUserCode": {
            "$ref": "#/components/schemas/UserCode"
          },
          "issuedByName": {
            "type": "string",
            "minLength": 1,
            "maxLength": 120
          },
          "issuedVia": {
            "$ref": "#/components/schemas/IssuedVia"
          },
          "recurringScheduleId": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Id"
              },
              {
                "type": "null"
              }
            ]
          },
          "business": {
            "$ref": "#/components/schemas/PublicApiBusinessSnapshot"
          },
          "customer": {
            "$ref": "#/components/schemas/CustomerSnapshot"
          },
          "original": {
            "$ref": "#/components/schemas/OriginalState"
          },
          "quoteAcceptance": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/QuoteAcceptance"
              },
              {
                "type": "null"
              }
            ]
          },
          "creditAcknowledgement": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/CreditAcknowledgement"
              },
              {
                "type": "null"
              }
            ]
          },
          "badDebtNotice": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/BadDebtNotice"
              },
              {
                "type": "null"
              }
            ]
          },
          "printedNotices": {
            "maxItems": 20,
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PrintedNotice"
            }
          },
          "contentHash": {
            "$ref": "#/components/schemas/Sha256Hex"
          },
          "isDemo": {
            "type": "boolean"
          },
          "allocation": {
            "$ref": "#/components/schemas/PublicApiAllocation"
          },
          "allocationApproval": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/PublicApiAllocationApproval"
              },
              {
                "type": "null"
              }
            ]
          },
          "cancellation": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/PublicApiDocumentCancellation"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "businessId",
          "type",
          "titleVariant",
          "series",
          "seriesPrefix",
          "language",
          "currency",
          "foreign",
          "pricesIncludeVat",
          "documentDate",
          "dueDate",
          "valueDate",
          "exitTime",
          "customerId",
          "subject",
          "lines",
          "payments",
          "totals",
          "vatBreakdown",
          "creditReason",
          "notes",
          "internalNotes",
          "references",
          "createdByUserId",
          "createdAt",
          "status",
          "openFormatCode",
          "number",
          "issuedAt",
          "issuedByUserId",
          "issuedByUserCode",
          "issuedByName",
          "business",
          "customer",
          "original",
          "quoteAcceptance",
          "creditAcknowledgement",
          "contentHash",
          "isDemo",
          "allocation",
          "cancellation"
        ]
      },
      "PublicApiPayment": {
        "oneOf": [
          {
            "type": "object",
            "properties": {
              "method": {
                "type": "string",
                "const": "cash"
              },
              "lineNo": {
                "type": "integer",
                "minimum": 1,
                "maximum": 9999
              },
              "amount": {
                "minimum": 1,
                "$ref": "#/components/schemas/Agorot"
              },
              "foreign": {
                "anyOf": [
                  {
                    "$ref": "#/components/schemas/ForeignPaymentAmount"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "date": {
                "$ref": "#/components/schemas/LocalDate"
              }
            },
            "required": [
              "method",
              "lineNo",
              "amount",
              "date"
            ]
          },
          {
            "type": "object",
            "properties": {
              "method": {
                "type": "string",
                "const": "cheque"
              },
              "lineNo": {
                "type": "integer",
                "minimum": 1,
                "maximum": 9999
              },
              "amount": {
                "minimum": 1,
                "$ref": "#/components/schemas/Agorot"
              },
              "foreign": {
                "anyOf": [
                  {
                    "$ref": "#/components/schemas/ForeignPaymentAmount"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "date": {
                "$ref": "#/components/schemas/LocalDate"
              },
              "dueDate": {
                "$ref": "#/components/schemas/LocalDate"
              },
              "bankCode": {
                "type": "string",
                "pattern": "^\\d{1,10}$"
              },
              "branchCode": {
                "type": "string",
                "pattern": "^\\d{1,10}$"
              },
              "accountNumber": {
                "type": "string",
                "pattern": "^\\d{1,15}$"
              },
              "chequeNumber": {
                "type": "string",
                "pattern": "^\\d{1,10}$"
              },
              "crossedNonNegotiable": {
                "type": "boolean"
              },
              "payeeNamed": {
                "type": "boolean"
              },
              "endorsed": {
                "type": "boolean"
              },
              "endorserName": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 120
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "endorserId": {
                "anyOf": [
                  {
                    "type": "string",
                    "pattern": "^\\d{5,9}$"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "method",
              "lineNo",
              "amount",
              "date",
              "dueDate",
              "bankCode",
              "branchCode",
              "accountNumber",
              "chequeNumber"
            ]
          },
          {
            "type": "object",
            "properties": {
              "method": {
                "type": "string",
                "const": "credit"
              },
              "lineNo": {
                "type": "integer",
                "minimum": 1,
                "maximum": 9999
              },
              "amount": {
                "minimum": 1,
                "$ref": "#/components/schemas/Agorot"
              },
              "foreign": {
                "anyOf": [
                  {
                    "$ref": "#/components/schemas/ForeignPaymentAmount"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "date": {
                "$ref": "#/components/schemas/LocalDate"
              },
              "dueDate": {
                "anyOf": [
                  {
                    "$ref": "#/components/schemas/LocalDate"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "acquirer": {
                "anyOf": [
                  {
                    "$ref": "#/components/schemas/CardAcquirer"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "brandName": {
                "anyOf": [
                  {
                    "type": "string",
                    "maxLength": 20
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "last4": {
                "anyOf": [
                  {
                    "type": "string",
                    "pattern": "^\\d{4}$"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "dealType": {
                "$ref": "#/components/schemas/CardDealType"
              },
              "installments": {
                "anyOf": [
                  {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 99
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "customerOwnCard": {
                "type": "boolean"
              }
            },
            "required": [
              "method",
              "lineNo",
              "amount",
              "date",
              "dueDate",
              "acquirer",
              "brandName",
              "last4",
              "dealType",
              "installments"
            ]
          },
          {
            "type": "object",
            "properties": {
              "method": {
                "type": "string",
                "const": "transfer"
              },
              "lineNo": {
                "type": "integer",
                "minimum": 1,
                "maximum": 9999
              },
              "amount": {
                "minimum": 1,
                "$ref": "#/components/schemas/Agorot"
              },
              "foreign": {
                "anyOf": [
                  {
                    "$ref": "#/components/schemas/ForeignPaymentAmount"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "date": {
                "$ref": "#/components/schemas/LocalDate"
              },
              "reference": {
                "anyOf": [
                  {
                    "type": "string",
                    "maxLength": 40
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "directFromCustomerAccount": {
                "type": "boolean"
              }
            },
            "required": [
              "method",
              "lineNo",
              "amount",
              "date",
              "reference"
            ]
          },
          {
            "type": "object",
            "properties": {
              "method": {
                "type": "string",
                "const": "bit"
              },
              "lineNo": {
                "type": "integer",
                "minimum": 1,
                "maximum": 9999
              },
              "amount": {
                "minimum": 1,
                "$ref": "#/components/schemas/Agorot"
              },
              "foreign": {
                "anyOf": [
                  {
                    "$ref": "#/components/schemas/ForeignPaymentAmount"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "date": {
                "$ref": "#/components/schemas/LocalDate"
              },
              "appName": {
                "anyOf": [
                  {
                    "type": "string",
                    "maxLength": 30
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "reference": {
                "anyOf": [
                  {
                    "type": "string",
                    "maxLength": 40
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "method",
              "lineNo",
              "amount",
              "date",
              "appName",
              "reference"
            ]
          },
          {
            "type": "object",
            "properties": {
              "method": {
                "type": "string",
                "const": "voucher"
              },
              "lineNo": {
                "type": "integer",
                "minimum": 1,
                "maximum": 9999
              },
              "amount": {
                "minimum": 1,
                "$ref": "#/components/schemas/Agorot"
              },
              "foreign": {
                "anyOf": [
                  {
                    "$ref": "#/components/schemas/ForeignPaymentAmount"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "date": {
                "$ref": "#/components/schemas/LocalDate"
              },
              "description": {
                "anyOf": [
                  {
                    "type": "string",
                    "maxLength": 60
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "method",
              "lineNo",
              "amount",
              "date",
              "description"
            ]
          },
          {
            "type": "object",
            "properties": {
              "method": {
                "type": "string",
                "const": "exchange_slip"
              },
              "lineNo": {
                "type": "integer",
                "minimum": 1,
                "maximum": 9999
              },
              "amount": {
                "minimum": 1,
                "$ref": "#/components/schemas/Agorot"
              },
              "foreign": {
                "anyOf": [
                  {
                    "$ref": "#/components/schemas/ForeignPaymentAmount"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "date": {
                "$ref": "#/components/schemas/LocalDate"
              },
              "reference": {
                "anyOf": [
                  {
                    "type": "string",
                    "maxLength": 40
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "method",
              "lineNo",
              "amount",
              "date",
              "reference"
            ]
          },
          {
            "type": "object",
            "properties": {
              "method": {
                "type": "string",
                "const": "promissory_note"
              },
              "lineNo": {
                "type": "integer",
                "minimum": 1,
                "maximum": 9999
              },
              "amount": {
                "minimum": 1,
                "$ref": "#/components/schemas/Agorot"
              },
              "foreign": {
                "anyOf": [
                  {
                    "$ref": "#/components/schemas/ForeignPaymentAmount"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "date": {
                "$ref": "#/components/schemas/LocalDate"
              },
              "dueDate": {
                "anyOf": [
                  {
                    "$ref": "#/components/schemas/LocalDate"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "reference": {
                "anyOf": [
                  {
                    "type": "string",
                    "maxLength": 40
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "method",
              "lineNo",
              "amount",
              "date",
              "dueDate",
              "reference"
            ]
          },
          {
            "type": "object",
            "properties": {
              "method": {
                "type": "string",
                "const": "standing_order"
              },
              "lineNo": {
                "type": "integer",
                "minimum": 1,
                "maximum": 9999
              },
              "amount": {
                "minimum": 1,
                "$ref": "#/components/schemas/Agorot"
              },
              "foreign": {
                "anyOf": [
                  {
                    "$ref": "#/components/schemas/ForeignPaymentAmount"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "date": {
                "$ref": "#/components/schemas/LocalDate"
              },
              "reference": {
                "anyOf": [
                  {
                    "type": "string",
                    "maxLength": 40
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "method",
              "lineNo",
              "amount",
              "date",
              "reference"
            ]
          },
          {
            "type": "object",
            "properties": {
              "method": {
                "type": "string",
                "const": "other"
              },
              "lineNo": {
                "type": "integer",
                "minimum": 1,
                "maximum": 9999
              },
              "amount": {
                "minimum": 1,
                "$ref": "#/components/schemas/Agorot"
              },
              "foreign": {
                "anyOf": [
                  {
                    "$ref": "#/components/schemas/ForeignPaymentAmount"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "date": {
                "$ref": "#/components/schemas/LocalDate"
              },
              "description": {
                "type": "string",
                "minLength": 1,
                "maxLength": 60
              }
            },
            "required": [
              "method",
              "lineNo",
              "amount",
              "date",
              "description"
            ]
          }
        ]
      },
      "PublicApiReminderRecord": {
        "type": "object",
        "properties": {
          "id": {
            "$ref": "#/components/schemas/Id"
          },
          "key": {
            "type": "string",
            "pattern": "^(?:(?:before|after):\\d{1,2}|manual)$"
          },
          "automatic": {
            "type": "boolean"
          },
          "on": {
            "$ref": "#/components/schemas/LocalDate"
          },
          "at": {
            "$ref": "#/components/schemas/Timestamp"
          },
          "channel": {
            "type": "string",
            "enum": [
              "email",
              "whatsapp_share"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "queued",
              "sent",
              "delivered",
              "bounced",
              "complained",
              "failed",
              "shared",
              "not_sent"
            ]
          },
          "recipientsMasked": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 254
              },
              {
                "type": "null"
              }
            ]
          },
          "deliveryId": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Id"
              },
              {
                "type": "null"
              }
            ]
          },
          "openAmount": {
            "$ref": "#/components/schemas/Agorot"
          }
        },
        "required": [
          "id",
          "key",
          "automatic",
          "on",
          "at",
          "channel",
          "status",
          "recipientsMasked",
          "deliveryId",
          "openAmount"
        ]
      },
      "PublicApiRenditions": {
        "type": "array",
        "items": {
          "$ref": "#/components/schemas/Rendition"
        }
      },
      "PublicApiReportExport": {
        "type": "object",
        "properties": {
          "id": {
            "$ref": "#/components/schemas/Id"
          },
          "report": {
            "$ref": "#/components/schemas/PublicApiReportKind"
          },
          "format": {
            "$ref": "#/components/schemas/ReportExportFormat"
          },
          "status": {
            "$ref": "#/components/schemas/JobStatus"
          },
          "params": {
            "type": "object",
            "properties": {
              "from": {
                "anyOf": [
                  {
                    "$ref": "#/components/schemas/LocalDate"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "to": {
                "anyOf": [
                  {
                    "$ref": "#/components/schemas/LocalDate"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "asOf": {
                "anyOf": [
                  {
                    "$ref": "#/components/schemas/LocalDate"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "documentCount": {
                "type": "integer",
                "minimum": 1,
                "maximum": 10000
              },
              "filters": {
                "type": "object",
                "properties": {
                  "type": {
                    "$ref": "#/components/schemas/DocumentType"
                  },
                  "variant": {
                    "$ref": "#/components/schemas/DocumentVariant"
                  },
                  "status": {
                    "$ref": "#/components/schemas/DocumentStatus"
                  },
                  "customerId": {
                    "$ref": "#/components/schemas/Id"
                  },
                  "from": {
                    "$ref": "#/components/schemas/LocalDate"
                  },
                  "to": {
                    "$ref": "#/components/schemas/LocalDate"
                  },
                  "q": {
                    "type": "string",
                    "maxLength": 100
                  },
                  "amountFrom": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 99999999999999
                  },
                  "amountTo": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 99999999999999
                  },
                  "paymentMethod": {
                    "$ref": "#/components/schemas/PaymentMethod"
                  },
                  "cancelled": {
                    "type": "string",
                    "enum": [
                      "only",
                      "exclude"
                    ]
                  }
                }
              },
              "customerId": {
                "$ref": "#/components/schemas/Id"
              },
              "documentType": {
                "$ref": "#/components/schemas/DocumentType"
              }
            },
            "required": [
              "from",
              "to",
              "asOf"
            ]
          },
          "file": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/StoredFile"
              },
              {
                "type": "null"
              }
            ]
          },
          "summary": {
            "anyOf": [
              {
                "type": "object",
                "propertyNames": {
                  "type": "string"
                },
                "additionalProperties": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                }
              },
              {
                "type": "null"
              }
            ]
          },
          "problem": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 500
              },
              {
                "type": "null"
              }
            ]
          },
          "createdAt": {
            "$ref": "#/components/schemas/Timestamp"
          },
          "finishedAt": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Timestamp"
              },
              {
                "type": "null"
              }
            ]
          },
          "expiresAt": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Timestamp"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "report",
          "format",
          "status",
          "params",
          "file",
          "summary",
          "problem",
          "createdAt",
          "finishedAt",
          "expiresAt"
        ]
      },
      "PublicApiReportKind": {
        "type": "string",
        "enum": [
          "income",
          "expenses",
          "vat",
          "pcn874",
          "advances",
          "profit_and_loss",
          "receipts_book",
          "open_debts",
          "sequence_check",
          "report_2_6",
          "audit_log",
          "documents_pdf_bundle",
          "customers",
          "items",
          "documents_list"
        ]
      },
      "PublicApiSelfInvoiceDetails": {
        "type": "object",
        "properties": {
          "basis": {
            "$ref": "#/components/schemas/SelfInvoiceBasis"
          },
          "supplier": {
            "type": "object",
            "properties": {
              "name": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              },
              "idType": {
                "$ref": "#/components/schemas/SupplierIdType"
              },
              "idNumber": {
                "type": "string",
                "minLength": 1,
                "maxLength": 30
              },
              "address": {
                "anyOf": [
                  {
                    "$ref": "#/components/schemas/Address"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "countryCode": {
                "$ref": "#/components/schemas/CountryCode"
              }
            },
            "required": [
              "name",
              "idType",
              "idNumber",
              "address",
              "countryCode"
            ]
          },
          "supplierDocument": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "number": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 20
                  },
                  "date": {
                    "$ref": "#/components/schemas/LocalDate"
                  },
                  "allocationNumber": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^\\d{9}$"
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "x-tax-authority-data": true
                  }
                },
                "required": [
                  "number",
                  "date",
                  "allocationNumber"
                ]
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "basis",
          "supplier",
          "supplierDocument"
        ]
      },
      "Quantity": {
        "type": "string",
        "pattern": "^(?!0+(?:\\.0+)?$)\\d{1,12}(?:\\.\\d{1,4})?$"
      },
      "QuoteAcceptance": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "signed",
              "declined",
              "expired"
            ]
          },
          "signedAt": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Timestamp"
              },
              {
                "type": "null"
              }
            ]
          },
          "signerName": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              },
              {
                "type": "null"
              }
            ]
          },
          "signatureImage": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/StoredFile"
              },
              {
                "type": "null"
              }
            ]
          },
          "signedContentHash": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Sha256Hex"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "status",
          "signedAt",
          "signerName",
          "signatureImage",
          "signedContentHash"
        ]
      },
      "ReceiptDetailLine": {
        "type": "object",
        "properties": {
          "lineNo": {
            "type": "integer",
            "minimum": 1,
            "maximum": 100
          },
          "description": {
            "type": "string",
            "minLength": 1,
            "maxLength": 500
          },
          "quantity": {
            "$ref": "#/components/schemas/Quantity"
          },
          "unitPrice": {
            "$ref": "#/components/schemas/Agorot"
          },
          "total": {
            "$ref": "#/components/schemas/Agorot"
          }
        },
        "required": [
          "lineNo",
          "description",
          "quantity",
          "unitPrice",
          "total"
        ]
      },
      "ReceiptDetailLineInput": {
        "type": "object",
        "properties": {
          "description": {
            "type": "string",
            "minLength": 1,
            "maxLength": 500
          },
          "quantity": {
            "$ref": "#/components/schemas/Quantity"
          },
          "unitPrice": {
            "$ref": "#/components/schemas/MinorUnits"
          }
        },
        "required": [
          "description",
          "quantity",
          "unitPrice"
        ],
        "additionalProperties": false
      },
      "ReceiptsBookReport": {
        "type": "object",
        "properties": {
          "meta": {
            "$ref": "#/components/schemas/ReportMeta"
          },
          "rows": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "documentId": {
                  "$ref": "#/components/schemas/Id"
                },
                "type": {
                  "type": "string",
                  "enum": [
                    "receipt",
                    "tax_invoice_receipt"
                  ]
                },
                "number": {
                  "$ref": "#/components/schemas/DocumentNumber"
                },
                "documentDate": {
                  "$ref": "#/components/schemas/LocalDate"
                },
                "customerName": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 120
                },
                "amount": {
                  "$ref": "#/components/schemas/Agorot"
                },
                "withholding": {
                  "$ref": "#/components/schemas/Agorot"
                },
                "methods": {
                  "maxItems": 10,
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/PaymentMethod"
                  }
                },
                "cancelled": {
                  "type": "boolean"
                }
              },
              "required": [
                "documentId",
                "type",
                "number",
                "documentDate",
                "customerName",
                "amount",
                "withholding",
                "methods",
                "cancelled"
              ]
            }
          },
          "byMethod": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "method": {
                  "$ref": "#/components/schemas/PaymentMethod"
                },
                "count": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                },
                "amount": {
                  "$ref": "#/components/schemas/Agorot"
                }
              },
              "required": [
                "method",
                "count",
                "amount"
              ]
            }
          },
          "total": {
            "$ref": "#/components/schemas/Agorot"
          },
          "withholdingTotal": {
            "$ref": "#/components/schemas/Agorot"
          }
        },
        "required": [
          "meta",
          "rows",
          "byMethod",
          "total",
          "withholdingTotal"
        ]
      },
      "ReceivedFileCheck": {
        "type": "object",
        "properties": {
          "sha256": {
            "$ref": "#/components/schemas/Sha256Hex"
          },
          "status": {
            "$ref": "#/components/schemas/ReceivedSignatureStatus"
          },
          "reason": {
            "type": "string",
            "pattern": "^[A-Za-z_]{1,48}$"
          },
          "signer": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/ReceivedFileSigner"
              },
              {
                "type": "null"
              }
            ]
          },
          "authority": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "subject": {
                    "type": "string",
                    "maxLength": 1000
                  },
                  "certificateSha256": {
                    "$ref": "#/components/schemas/Sha256Hex"
                  }
                },
                "required": [
                  "subject",
                  "certificateSha256"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "signedAt": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Timestamp"
              },
              {
                "type": "null"
              }
            ]
          },
          "signatureCount": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100
          },
          "revocation": {
            "type": "string",
            "const": "not_checked"
          },
          "checkedAt": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Timestamp"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "sha256",
          "status",
          "reason",
          "signer",
          "authority",
          "signedAt",
          "signatureCount",
          "revocation",
          "checkedAt"
        ]
      },
      "ReceivedFileSigner": {
        "type": "object",
        "properties": {
          "subject": {
            "type": "string",
            "maxLength": 1000
          },
          "issuer": {
            "type": "string",
            "maxLength": 1000
          },
          "certificateSha256": {
            "$ref": "#/components/schemas/Sha256Hex"
          },
          "validFrom": {
            "$ref": "#/components/schemas/Timestamp"
          },
          "validTo": {
            "$ref": "#/components/schemas/Timestamp"
          },
          "identityNumbers": {
            "maxItems": 5,
            "type": "array",
            "items": {
              "type": "string",
              "pattern": "^\\d{9}$"
            }
          }
        },
        "required": [
          "subject",
          "issuer",
          "certificateSha256",
          "validFrom",
          "validTo",
          "identityNumbers"
        ]
      },
      "ReceivedSignatureStatus": {
        "type": "string",
        "enum": [
          "approved",
          "signed",
          "changed_after_signing",
          "invalid",
          "unsigned",
          "not_checked"
        ]
      },
      "Rendition": {
        "type": "object",
        "properties": {
          "id": {
            "$ref": "#/components/schemas/Id"
          },
          "documentId": {
            "$ref": "#/components/schemas/Id"
          },
          "marking": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/CopyMarking"
              },
              {
                "type": "null"
              }
            ]
          },
          "purpose": {
            "$ref": "#/components/schemas/RenditionPurpose"
          },
          "channel": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/DeliveryChannel"
              },
              {
                "type": "null"
              }
            ]
          },
          "language": {
            "$ref": "#/components/schemas/DocumentLanguage"
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "ready",
              "failed"
            ]
          },
          "file": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/StoredFile"
              },
              {
                "type": "null"
              }
            ]
          },
          "signatureStatus": {
            "$ref": "#/components/schemas/SignatureStatus"
          },
          "computerizedDocumentNotice": {
            "type": "boolean"
          },
          "cancelledMark": {
            "type": "boolean"
          },
          "createdAt": {
            "$ref": "#/components/schemas/Timestamp"
          },
          "createdByUserId": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Id"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "documentId",
          "marking",
          "purpose",
          "channel",
          "language",
          "status",
          "file",
          "signatureStatus",
          "computerizedDocumentNotice",
          "cancelledMark",
          "createdAt",
          "createdByUserId"
        ]
      },
      "RenditionPurpose": {
        "type": "string",
        "enum": [
          "business_copy",
          "customer_delivery",
          "print_paper_original",
          "print_copy",
          "draft_preview"
        ]
      },
      "RenditionResult": {
        "type": "object",
        "properties": {
          "rendition": {
            "$ref": "#/components/schemas/Rendition"
          },
          "download": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/DownloadLink"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "rendition",
          "download"
        ]
      },
      "Report26": {
        "type": "object",
        "properties": {
          "meta": {
            "$ref": "#/components/schemas/ReportMeta"
          },
          "rows": {
            "minItems": 27,
            "maxItems": 27,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "code": {
                  "$ref": "#/components/schemas/OpenFormatDocCode"
                },
                "he": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 60
                },
                "count": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                },
                "amount": {
                  "$ref": "#/components/schemas/SignedAgorot"
                },
                "amountBeforeVat": {
                  "$ref": "#/components/schemas/SignedAgorot"
                }
              },
              "required": [
                "code",
                "he",
                "count",
                "amount",
                "amountBeforeVat"
              ]
            }
          }
        },
        "required": [
          "meta",
          "rows"
        ]
      },
      "ReportExportFormat": {
        "type": "string",
        "enum": [
          "pdf",
          "csv",
          "xlsx",
          "pcn874_txt",
          "zip"
        ]
      },
      "ReportMeta": {
        "type": "object",
        "properties": {
          "businessName": {
            "type": "string",
            "minLength": 1,
            "maxLength": 120
          },
          "businessVatNumber": {
            "$ref": "#/components/schemas/VatNumber"
          },
          "title": {
            "type": "string",
            "minLength": 1,
            "maxLength": 120
          },
          "period": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "from": {
                    "$ref": "#/components/schemas/LocalDate"
                  },
                  "to": {
                    "$ref": "#/components/schemas/LocalDate"
                  }
                },
                "required": [
                  "from",
                  "to"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "asOf": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/LocalDate"
              },
              {
                "type": "null"
              }
            ]
          },
          "generatedAt": {
            "$ref": "#/components/schemas/Timestamp"
          }
        },
        "required": [
          "businessName",
          "businessVatNumber",
          "title",
          "period",
          "asOf",
          "generatedAt"
        ]
      },
      "RequestId": {
        "type": "string",
        "pattern": "^[A-Za-z0-9_-]{8,64}$"
      },
      "SelfInvoiceBasis": {
        "type": "string",
        "enum": [
          "salaried_service_provider_r6a",
          "real_estate_from_non_dealer_r6b",
          "intangible_import_r6c",
          "foreign_resident_seller_r6d",
          "scrap_metals_r6z",
          "reverse_charge_s47a3"
        ]
      },
      "SendToCustomerRequest": {
        "type": "object",
        "properties": {},
        "additionalProperties": false
      },
      "SendToCustomerResult": {
        "type": "object",
        "properties": {
          "delivery": {
            "$ref": "#/components/schemas/Delivery"
          },
          "consent": {
            "$ref": "#/components/schemas/ConsentState"
          },
          "originalAfterConsent": {
            "type": "boolean"
          }
        },
        "required": [
          "delivery",
          "consent",
          "originalAfterConsent"
        ]
      },
      "SequenceCheckReport": {
        "type": "object",
        "properties": {
          "meta": {
            "$ref": "#/components/schemas/ReportMeta"
          },
          "series": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "series": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 20
                },
                "documentTypes": {
                  "minItems": 1,
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/DocumentType"
                  }
                },
                "startingNumber": {
                  "$ref": "#/components/schemas/DocumentNumber"
                },
                "startingNumberSetAt": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/Timestamp"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "previousSoftwareName": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 80
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "firstNumber": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/DocumentNumber"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "lastNumber": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/DocumentNumber"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "count": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                },
                "existingRanges": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "from": {
                        "$ref": "#/components/schemas/DocumentNumber"
                      },
                      "to": {
                        "$ref": "#/components/schemas/DocumentNumber"
                      }
                    },
                    "required": [
                      "from",
                      "to"
                    ]
                  }
                },
                "missing": {
                  "maxItems": 10000,
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/DocumentNumber"
                  }
                },
                "missingCount": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                },
                "missingTruncated": {
                  "type": "boolean"
                },
                "missingRanges": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/DocumentNumberRange"
                  }
                },
                "cancelled": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/DocumentNumber"
                  }
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "ok",
                    "missing_numbers"
                  ]
                }
              },
              "required": [
                "series",
                "documentTypes",
                "startingNumber",
                "startingNumberSetAt",
                "previousSoftwareName",
                "firstNumber",
                "lastNumber",
                "count",
                "existingRanges",
                "missing",
                "missingCount",
                "missingTruncated",
                "cancelled",
                "status"
              ]
            }
          }
        },
        "required": [
          "meta",
          "series"
        ]
      },
      "SeriesPrefix": {
        "type": "string",
        "pattern": "^[A-Z]{1,5}$"
      },
      "Sha256Hex": {
        "type": "string",
        "pattern": "^[a-f0-9]{64}$"
      },
      "SignatureMode": {
        "type": "string",
        "enum": [
          "secured_business_key",
          "approved_certificate"
        ]
      },
      "SignatureStatus": {
        "type": "string",
        "enum": [
          "not_applicable",
          "pending",
          "signed",
          "failed"
        ]
      },
      "SignedAgorot": {
        "type": "integer",
        "minimum": -99999999999999,
        "maximum": 99999999999999
      },
      "StoredFile": {
        "type": "object",
        "properties": {
          "objectKey": {
            "$ref": "#/components/schemas/ObjectKey"
          },
          "contentType": {
            "type": "string",
            "pattern": "^[a-z]+\\/[a-z0-9.+-]+$"
          },
          "sizeBytes": {
            "type": "integer",
            "minimum": 0,
            "maximum": 104857600
          },
          "sha256": {
            "$ref": "#/components/schemas/Sha256Hex"
          }
        },
        "required": [
          "objectKey",
          "contentType",
          "sizeBytes",
          "sha256"
        ]
      },
      "SupplierIdType": {
        "type": "string",
        "enum": [
          "vat_number",
          "israeli_id",
          "foreign_tax_id",
          "passport"
        ]
      },
      "TenantKind": {
        "type": "string",
        "enum": [
          "standard",
          "store_review"
        ]
      },
      "Timestamp": {
        "type": "string",
        "format": "date-time"
      },
      "TransferAccountInput": {
        "type": "object",
        "properties": {
          "bankCode": {
            "type": "string",
            "pattern": "^\\d{2,3}$"
          },
          "branchCode": {
            "type": "string",
            "pattern": "^\\d{3,4}$"
          },
          "accountNumber": {
            "type": "string",
            "pattern": "^\\d{1,15}$"
          }
        },
        "required": [
          "bankCode",
          "branchCode",
          "accountNumber"
        ],
        "additionalProperties": false
      },
      "UserCode": {
        "type": "string",
        "pattern": "^[A-Za-z0-9]{1,9}$"
      },
      "VatBreakdownRow": {
        "type": "object",
        "properties": {
          "vatTreatment": {
            "$ref": "#/components/schemas/VatTreatment"
          },
          "rateBp": {
            "$ref": "#/components/schemas/VatRateBasisPoints"
          },
          "net": {
            "$ref": "#/components/schemas/Agorot"
          },
          "vat": {
            "$ref": "#/components/schemas/Agorot"
          }
        },
        "required": [
          "vatTreatment",
          "rateBp",
          "net",
          "vat"
        ]
      },
      "VatFilingConfirmationRef": {
        "type": "string",
        "minLength": 1,
        "maxLength": 40,
        "pattern": "^[0-9A-Za-z/.\\- ]+$"
      },
      "VatNumber": {
        "type": "string",
        "pattern": "^\\d{9}$"
      },
      "VatRateBasisPoints": {
        "type": "integer",
        "minimum": 0,
        "maximum": 10000
      },
      "VatReason": {
        "type": "object",
        "properties": {
          "code": {
            "$ref": "#/components/schemas/VatReasonCode"
          },
          "text": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 200
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "code",
          "text"
        ]
      },
      "VatReasonCode": {
        "type": "string",
        "enum": [
          "export_goods_s30a1",
          "intangible_to_foreign_resident_s30a2",
          "service_to_foreign_resident_s30a5",
          "service_abroad_s30a7",
          "tourism_service_s30a8",
          "international_transport_s30a10",
          "eilat_listed_service_r20a",
          "eilat_passenger_transport_r20b",
          "reverse_charge_replacement_s47a3",
          "other_zero_rate",
          "eilat_resident_service_s5h",
          "eilat_resident_goods_s5c",
          "eilat_real_estate_s5d",
          "other_exempt"
        ]
      },
      "VatReasonInput": {
        "type": "object",
        "properties": {
          "code": {
            "$ref": "#/components/schemas/VatReasonCode"
          },
          "text": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          }
        },
        "required": [
          "code"
        ],
        "additionalProperties": false
      },
      "VatReport": {
        "type": "object",
        "properties": {
          "meta": {
            "$ref": "#/components/schemas/ReportMeta"
          },
          "sales": {
            "type": "object",
            "properties": {
              "taxableNet": {
                "$ref": "#/components/schemas/Agorot"
              },
              "vat": {
                "$ref": "#/components/schemas/Agorot"
              },
              "zeroRatedNet": {
                "$ref": "#/components/schemas/Agorot"
              },
              "exemptNet": {
                "$ref": "#/components/schemas/Agorot"
              },
              "documents": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "taxableNet",
              "vat",
              "zeroRatedNet",
              "exemptNet",
              "documents"
            ]
          },
          "credits": {
            "type": "object",
            "properties": {
              "acknowledged": {
                "type": "object",
                "properties": {
                  "net": {
                    "$ref": "#/components/schemas/Agorot"
                  },
                  "vat": {
                    "$ref": "#/components/schemas/Agorot"
                  },
                  "count": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  }
                },
                "required": [
                  "net",
                  "vat",
                  "count"
                ]
              },
              "pending": {
                "type": "object",
                "properties": {
                  "net": {
                    "$ref": "#/components/schemas/Agorot"
                  },
                  "vat": {
                    "$ref": "#/components/schemas/Agorot"
                  },
                  "count": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  }
                },
                "required": [
                  "net",
                  "vat",
                  "count"
                ]
              }
            },
            "required": [
              "acknowledged",
              "pending"
            ]
          },
          "inputs": {
            "type": "object",
            "properties": {
              "fixedAssets": {
                "type": "object",
                "properties": {
                  "net": {
                    "$ref": "#/components/schemas/Agorot"
                  },
                  "vat": {
                    "$ref": "#/components/schemas/Agorot"
                  },
                  "deductibleVat": {
                    "$ref": "#/components/schemas/Agorot"
                  }
                },
                "required": [
                  "net",
                  "vat",
                  "deductibleVat"
                ]
              },
              "other": {
                "type": "object",
                "properties": {
                  "net": {
                    "$ref": "#/components/schemas/Agorot"
                  },
                  "vat": {
                    "$ref": "#/components/schemas/Agorot"
                  },
                  "deductibleVat": {
                    "$ref": "#/components/schemas/Agorot"
                  }
                },
                "required": [
                  "net",
                  "vat",
                  "deductibleVat"
                ]
              }
            },
            "required": [
              "fixedAssets",
              "other"
            ]
          },
          "payable": {
            "$ref": "#/components/schemas/SignedAgorot"
          },
          "roundedShekels": {
            "type": "object",
            "properties": {
              "salesVat": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "inputsVat": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "payable": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "salesVat",
              "inputsVat",
              "payable"
            ]
          },
          "pendingCredits": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "documentId": {
                  "$ref": "#/components/schemas/Id"
                },
                "number": {
                  "$ref": "#/components/schemas/DocumentNumber"
                },
                "documentDate": {
                  "$ref": "#/components/schemas/LocalDate"
                },
                "vat": {
                  "$ref": "#/components/schemas/Agorot"
                },
                "reasonCode": {
                  "$ref": "#/components/schemas/CreditReasonCode"
                },
                "pendingBecause": {
                  "type": "string",
                  "enum": [
                    "acknowledgement_pending",
                    "online_unverified",
                    "bad_debt_notice_missing"
                  ]
                }
              },
              "required": [
                "documentId",
                "number",
                "documentDate",
                "vat",
                "reasonCode",
                "pendingBecause"
              ]
            }
          },
          "noVatExpenses": {
            "type": "object",
            "properties": {
              "net": {
                "$ref": "#/components/schemas/Agorot"
              },
              "byTreatment": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "vatTreatment": {
                      "$ref": "#/components/schemas/ExpenseVatTreatment"
                    },
                    "net": {
                      "$ref": "#/components/schemas/Agorot"
                    }
                  },
                  "required": [
                    "vatTreatment",
                    "net"
                  ]
                }
              }
            },
            "required": [
              "net",
              "byTreatment"
            ]
          },
          "selfInvoicesWithoutInput": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "documentId": {
                  "$ref": "#/components/schemas/Id"
                },
                "number": {
                  "$ref": "#/components/schemas/DocumentNumber"
                },
                "seriesPrefix": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/SeriesPrefix"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "documentDate": {
                  "$ref": "#/components/schemas/LocalDate"
                },
                "vat": {
                  "$ref": "#/components/schemas/Agorot"
                }
              },
              "required": [
                "documentId",
                "number",
                "seriesPrefix",
                "documentDate",
                "vat"
              ]
            }
          }
        },
        "required": [
          "meta",
          "sales",
          "credits",
          "inputs",
          "payable",
          "roundedShekels",
          "pendingCredits"
        ]
      },
      "VatReportFiling": {
        "type": "object",
        "properties": {
          "id": {
            "$ref": "#/components/schemas/Id"
          },
          "periodStart": {
            "$ref": "#/components/schemas/YearMonth"
          },
          "periodEnd": {
            "$ref": "#/components/schemas/YearMonth"
          },
          "file": {
            "$ref": "#/components/schemas/StoredFile"
          },
          "note": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 300
              },
              {
                "type": "null"
              }
            ]
          },
          "uploadedAt": {
            "$ref": "#/components/schemas/Timestamp"
          },
          "uploadedByUserId": {
            "$ref": "#/components/schemas/Id"
          },
          "netAmountAgorot": {
            "default": null,
            "anyOf": [
              {
                "$ref": "#/components/schemas/SignedAgorot"
              },
              {
                "type": "null"
              }
            ]
          },
          "paidOn": {
            "default": null,
            "anyOf": [
              {
                "$ref": "#/components/schemas/LocalDate"
              },
              {
                "type": "null"
              }
            ]
          },
          "confirmationRef": {
            "default": null,
            "anyOf": [
              {
                "$ref": "#/components/schemas/VatFilingConfirmationRef"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "periodStart",
          "periodEnd",
          "file",
          "note",
          "uploadedAt",
          "uploadedByUserId",
          "netAmountAgorot",
          "paidOn",
          "confirmationRef"
        ]
      },
      "VatReportingFrequency": {
        "type": "string",
        "enum": [
          "monthly",
          "bimonthly"
        ]
      },
      "VatTreatment": {
        "type": "string",
        "enum": [
          "standard",
          "zero_rated",
          "exempt",
          "none"
        ]
      },
      "YearMonth": {
        "type": "string",
        "pattern": "^\\d{4}-(?:0[1-9]|1[0-2])$"
      }
    },
    "responses": {
      "Error400": {
        "description": "Error (VALIDATION_FAILED, IDEMPOTENCY_KEY_REQUIRED); the codes a route can return are in its x-error-codes, a key's refusals in x-api-key-refusals.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/X-Request-Id"
          },
          "RateLimit-Limit": {
            "$ref": "#/components/headers/RateLimit-Limit"
          },
          "RateLimit-Remaining": {
            "$ref": "#/components/headers/RateLimit-Remaining"
          },
          "RateLimit-Reset": {
            "$ref": "#/components/headers/RateLimit-Reset"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ApiFailure"
            }
          }
        }
      },
      "Error401": {
        "description": "Error (UNAUTHENTICATED); the codes a route can return are in its x-error-codes, a key's refusals in x-api-key-refusals.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/X-Request-Id"
          },
          "RateLimit-Limit": {
            "$ref": "#/components/headers/RateLimit-Limit"
          },
          "RateLimit-Remaining": {
            "$ref": "#/components/headers/RateLimit-Remaining"
          },
          "RateLimit-Reset": {
            "$ref": "#/components/headers/RateLimit-Reset"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ApiFailure"
            }
          }
        }
      },
      "Error403": {
        "description": "Error (FORBIDDEN, ACCESS_EXPIRED, SOFTWARE_NOT_REGISTERED, DIGITAL_SENDING_DISABLED); the codes a route can return are in its x-error-codes, a key's refusals in x-api-key-refusals.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/X-Request-Id"
          },
          "RateLimit-Limit": {
            "$ref": "#/components/headers/RateLimit-Limit"
          },
          "RateLimit-Remaining": {
            "$ref": "#/components/headers/RateLimit-Remaining"
          },
          "RateLimit-Reset": {
            "$ref": "#/components/headers/RateLimit-Reset"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ApiFailure"
            }
          }
        }
      },
      "Error404": {
        "description": "Error (NOT_FOUND); the codes a route can return are in its x-error-codes, a key's refusals in x-api-key-refusals.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/X-Request-Id"
          },
          "RateLimit-Limit": {
            "$ref": "#/components/headers/RateLimit-Limit"
          },
          "RateLimit-Remaining": {
            "$ref": "#/components/headers/RateLimit-Remaining"
          },
          "RateLimit-Reset": {
            "$ref": "#/components/headers/RateLimit-Reset"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ApiFailure"
            }
          }
        }
      },
      "Error405": {
        "description": "Error (METHOD_NOT_ALLOWED); the codes a route can return are in its x-error-codes, a key's refusals in x-api-key-refusals.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/X-Request-Id"
          },
          "RateLimit-Limit": {
            "$ref": "#/components/headers/RateLimit-Limit"
          },
          "RateLimit-Remaining": {
            "$ref": "#/components/headers/RateLimit-Remaining"
          },
          "RateLimit-Reset": {
            "$ref": "#/components/headers/RateLimit-Reset"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ApiFailure"
            }
          }
        }
      },
      "Error409": {
        "description": "Error (CONFLICT, IDEMPOTENCY_REQUEST_IN_PROGRESS, BUSINESS_READ_ONLY, DOCUMENT_IMMUTABLE, TOTALS_CHANGED, CONSENT_REVOKED, RECIPIENT_SUPPRESSED, ALLOCATION_PENDING, ALLOCATION_DECISION_REQUIRED, JOB_NOT_READY); the codes a route can return are in its x-error-codes, a key's refusals in x-api-key-refusals.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/X-Request-Id"
          },
          "RateLimit-Limit": {
            "$ref": "#/components/headers/RateLimit-Limit"
          },
          "RateLimit-Remaining": {
            "$ref": "#/components/headers/RateLimit-Remaining"
          },
          "RateLimit-Reset": {
            "$ref": "#/components/headers/RateLimit-Reset"
          },
          "Retry-After": {
            "$ref": "#/components/headers/Retry-After"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ApiFailure"
            }
          }
        }
      },
      "Error413": {
        "description": "Error (PAYLOAD_TOO_LARGE); the codes a route can return are in its x-error-codes, a key's refusals in x-api-key-refusals.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/X-Request-Id"
          },
          "RateLimit-Limit": {
            "$ref": "#/components/headers/RateLimit-Limit"
          },
          "RateLimit-Remaining": {
            "$ref": "#/components/headers/RateLimit-Remaining"
          },
          "RateLimit-Reset": {
            "$ref": "#/components/headers/RateLimit-Reset"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ApiFailure"
            }
          }
        }
      },
      "Error415": {
        "description": "Error (UNSUPPORTED_MEDIA_TYPE); the codes a route can return are in its x-error-codes, a key's refusals in x-api-key-refusals.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/X-Request-Id"
          },
          "RateLimit-Limit": {
            "$ref": "#/components/headers/RateLimit-Limit"
          },
          "RateLimit-Remaining": {
            "$ref": "#/components/headers/RateLimit-Remaining"
          },
          "RateLimit-Reset": {
            "$ref": "#/components/headers/RateLimit-Reset"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ApiFailure"
            }
          }
        }
      },
      "Error422": {
        "description": "Error (IDEMPOTENCY_KEY_REUSED, DOCUMENT_NOT_ISSUED, DOCUMENT_TYPE_NOT_ALLOWED, CREDIT_EXCEEDS_REMAINING, PAPER_DELIVERY_REQUIRED, ALLOCATION_NOT_ELIGIBLE); the codes a route can return are in its x-error-codes, a key's refusals in x-api-key-refusals.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/X-Request-Id"
          },
          "RateLimit-Limit": {
            "$ref": "#/components/headers/RateLimit-Limit"
          },
          "RateLimit-Remaining": {
            "$ref": "#/components/headers/RateLimit-Remaining"
          },
          "RateLimit-Reset": {
            "$ref": "#/components/headers/RateLimit-Reset"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ApiFailure"
            }
          }
        }
      },
      "Error429": {
        "description": "Error (RATE_LIMITED, SENDING_LIMIT_REACHED); the codes a route can return are in its x-error-codes, a key's refusals in x-api-key-refusals.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/X-Request-Id"
          },
          "RateLimit-Limit": {
            "$ref": "#/components/headers/RateLimit-Limit"
          },
          "RateLimit-Remaining": {
            "$ref": "#/components/headers/RateLimit-Remaining"
          },
          "RateLimit-Reset": {
            "$ref": "#/components/headers/RateLimit-Reset"
          },
          "Retry-After": {
            "$ref": "#/components/headers/Retry-After"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ApiFailure"
            }
          }
        }
      },
      "Error500": {
        "description": "Error (INTERNAL); the codes a route can return are in its x-error-codes, a key's refusals in x-api-key-refusals.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/X-Request-Id"
          },
          "RateLimit-Limit": {
            "$ref": "#/components/headers/RateLimit-Limit"
          },
          "RateLimit-Remaining": {
            "$ref": "#/components/headers/RateLimit-Remaining"
          },
          "RateLimit-Reset": {
            "$ref": "#/components/headers/RateLimit-Reset"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ApiFailure"
            }
          }
        }
      },
      "Error501": {
        "description": "Error (NOT_IMPLEMENTED); the codes a route can return are in its x-error-codes, a key's refusals in x-api-key-refusals.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/X-Request-Id"
          },
          "RateLimit-Limit": {
            "$ref": "#/components/headers/RateLimit-Limit"
          },
          "RateLimit-Remaining": {
            "$ref": "#/components/headers/RateLimit-Remaining"
          },
          "RateLimit-Reset": {
            "$ref": "#/components/headers/RateLimit-Reset"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ApiFailure"
            }
          }
        }
      },
      "Error503": {
        "description": "Error (SERVICE_UNAVAILABLE); the codes a route can return are in its x-error-codes, a key's refusals in x-api-key-refusals.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/X-Request-Id"
          },
          "RateLimit-Limit": {
            "$ref": "#/components/headers/RateLimit-Limit"
          },
          "RateLimit-Remaining": {
            "$ref": "#/components/headers/RateLimit-Remaining"
          },
          "RateLimit-Reset": {
            "$ref": "#/components/headers/RateLimit-Reset"
          },
          "Retry-After": {
            "$ref": "#/components/headers/Retry-After"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ApiFailure"
            }
          }
        }
      }
    },
    "parameters": {
      "IdempotencyKey": {
        "name": "Idempotency-Key",
        "in": "header",
        "required": true,
        "description": "A new UUID made by the caller for each new request. Sending the same request again with the same key replays the stored answer (`Idempotent-Replayed: true`) and does nothing twice.",
        "schema": {
          "type": "string",
          "format": "uuid"
        }
      },
      "IdempotencyKeyOptional": {
        "name": "Idempotency-Key",
        "in": "header",
        "required": false,
        "description": "Optional: a UUID made by the caller. When sent, the same request with the same key replays the stored answer.",
        "schema": {
          "type": "string",
          "format": "uuid"
        }
      }
    },
    "headers": {
      "Idempotent-Replayed": {
        "description": "`true` when the answer is the stored answer of an earlier request with the same `Idempotency-Key`.",
        "schema": {
          "type": "boolean"
        }
      },
      "RateLimit-Limit": {
        "description": "Requests a key may make in the current minute (120).",
        "schema": {
          "type": "integer"
        }
      },
      "RateLimit-Remaining": {
        "description": "Requests left in the current minute window.",
        "schema": {
          "type": "integer"
        }
      },
      "RateLimit-Reset": {
        "description": "Seconds until the current minute window ends.",
        "schema": {
          "type": "integer"
        }
      },
      "Retry-After": {
        "description": "Seconds to wait before retrying (RATE_LIMITED, JOB_NOT_READY, SERVICE_UNAVAILABLE).",
        "schema": {
          "type": "integer"
        }
      },
      "X-Request-Id": {
        "description": "The request id (also `requestId` in the body): quote it to support.",
        "schema": {
          "type": "string"
        }
      }
    },
    "securitySchemes": {
      "apiKey": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "ak1.<keyId>.<secret>",
        "description": "`Authorization: Bearer ak1.<keyId>.<secret>` — the business's key, made in the app (\"חיבור מערכות (API)\") and shown once. `<keyId>` names the key (22 base64url characters), `<secret>` is 43. Up to 10 active keys per business, each valid at most 12 months. The requirement of each operation names the permission (scope) the key needs.",
        "x-pattern": "^ak1\\.[A-Za-z0-9_-]{22}\\.[A-Za-z0-9_-]{43}$",
        "x-prefix-pattern": "^ak1\\.[A-Za-z0-9_-]{22}$"
      }
    }
  },
  "x-public-api-version": "v1",
  "x-api-terms-version": "api-2026-11-01",
  "x-scopes": [
    {
      "scope": "business.read",
      "resource": "העסק",
      "level": "read",
      "hint": "פרטי העסק, ההגדרות והפרופיל לצורכי מס, בלי פרטי הבנק",
      "routes": [
        "businesses.get"
      ]
    },
    {
      "scope": "documents.read",
      "resource": "מסמכים",
      "level": "read",
      "hint": "המסמכים, ועותקים שלהם ב-PDF. אף פעם לא המקור",
      "routes": [
        "documents.list",
        "documents.get",
        "documents.listRenditions",
        "documents.createRendition",
        "documents.getRenditionDownload",
        "documents.getExchangeRate",
        "documents.search",
        "archive.list",
        "archive.get",
        "archive.downloadOriginal",
        "reports.customerLedger",
        "collections.overview",
        "collections.listStatuses",
        "collections.getDocument"
      ]
    },
    {
      "scope": "customers.read",
      "resource": "לקוחות",
      "level": "read",
      "hint": "רשימת הלקוחות. כתיבה: הוספה, עדכון והעברה לארכיון",
      "routes": [
        "customers.list",
        "customers.get",
        "customers.getPreferences"
      ]
    },
    {
      "scope": "customers.write",
      "resource": "לקוחות",
      "level": "write",
      "hint": "",
      "routes": [
        "customers.create",
        "customers.update",
        "customers.archive",
        "customers.unarchive",
        "customers.updatePreferences"
      ]
    },
    {
      "scope": "items.read",
      "resource": "פריטים",
      "level": "read",
      "hint": "רשימת הפריטים. כתיבה: הוספה, עדכון והעברה לארכיון",
      "routes": [
        "items.list",
        "items.get"
      ]
    },
    {
      "scope": "items.write",
      "resource": "פריטים",
      "level": "write",
      "hint": "",
      "routes": [
        "items.create",
        "items.update",
        "items.archive",
        "items.unarchive"
      ]
    },
    {
      "scope": "expenses.read",
      "resource": "הוצאות",
      "level": "read",
      "hint": "ההוצאות והקבצים שלהן, לקריאה בלבד",
      "routes": [
        "expenses.list",
        "expenses.get",
        "expenses.getAttachmentLink",
        "expenses.listCategories",
        "expenses.listVatReportFilings"
      ]
    },
    {
      "scope": "reports.read",
      "resource": "דוחות",
      "level": "read",
      "hint": "הדוחות. עם קבצים: גם הורדה של קבצי דוחות",
      "routes": [
        "reports.income",
        "reports.expenses",
        "reports.vat",
        "reports.advances",
        "reports.profitAndLoss",
        "reports.receiptsBook",
        "reports.openDebts",
        "reports.sequenceCheck",
        "reports.report26"
      ]
    },
    {
      "scope": "reports.export",
      "resource": "דוחות",
      "level": "write",
      "hint": "",
      "routes": [
        "reports.createExport",
        "reports.listExports",
        "reports.getExport",
        "reports.downloadExport"
      ]
    }
  ],
  "x-issuing": {
    "label": "הפקת מסמכים",
    "permissions": [
      "documents.write",
      "documents.issue"
    ],
    "readScopes": [
      "documents.read",
      "customers.read"
    ],
    "routes": [
      "documents.saveDraft",
      "documents.deleteDraft",
      "documents.compute",
      "documents.derive",
      "documents.issue"
    ],
    "documentTypes": [
      "tax_invoice",
      "tax_invoice_receipt",
      "receipt",
      "credit_invoice",
      "payment_demand"
    ],
    "refusedIssueFields": [
      "backdateReason",
      "manualAllocationNumber",
      "queuedAt"
    ],
    "approvalRequestMessage": "דרך מפתח לא מבקשים אישור הקצאה לחשבון עסקה. שולחים את הבקשה בלי requestAllocation.",
    "limits": {
      "perBusinessHour": 300,
      "perBusinessDay": 2000,
      "historyDays": 30
    }
  },
  "x-sending": {
    "label": "שליחה ללקוח",
    "permissions": [
      "documents.send"
    ],
    "readScopes": [
      "documents.read"
    ],
    "routes": [
      "delivery.sendToCustomer"
    ],
    "apiTermsVersion": "api-2026-11-05",
    "limits": {
      "perKeyHour": 50,
      "perKeyDay": 200,
      "perBusinessHour": 100,
      "perBusinessDay": 400
    }
  },
  "x-api-key-refusals": [
    {
      "detail": "API_KEY_INVALID",
      "code": "UNAUTHENTICATED",
      "status": 401,
      "message": "המפתח לא תקין. צריך לבדוק שהוא הועתק במלואו, או ליצור מפתח חדש בהגדרות.",
      "detailMessage": "המפתח לא תקין.",
      "path": [
        "header",
        "Authorization"
      ],
      "helpArticle": "sign-in"
    },
    {
      "detail": "API_KEY_REVOKED",
      "code": "UNAUTHENTICATED",
      "status": 401,
      "message": "המפתח בוטל. אפשר ליצור מפתח חדש בהגדרות, במסך \"חיבור מערכות\".",
      "detailMessage": "המפתח בוטל.",
      "path": [
        "header",
        "Authorization"
      ],
      "helpArticle": "sign-in"
    },
    {
      "detail": "API_KEY_EXPIRED",
      "code": "UNAUTHENTICATED",
      "status": 401,
      "message": "תוקף המפתח הסתיים. אפשר ליצור מפתח חדש בהגדרות, במסך \"חיבור מערכות\".",
      "detailMessage": "תוקף המפתח הסתיים.",
      "path": [
        "header",
        "Authorization"
      ],
      "helpArticle": "sign-in"
    },
    {
      "detail": "ROUTE_NOT_IN_PUBLIC_API",
      "code": "FORBIDDEN",
      "status": 403,
      "message": "את הפעולה הזו אי אפשר לעשות עם מפתח. אפשר לעשות אותה באפליקציה.",
      "detailMessage": "הפעולה לא פתוחה למפתחות.",
      "path": [
        "header",
        "Authorization"
      ],
      "helpArticle": "roles-and-permissions"
    },
    {
      "detail": "API_KEY_SCOPE_MISSING",
      "code": "FORBIDDEN",
      "status": 403,
      "message": "למפתח הזה אין הרשאה לפעולה. אפשר ליצור מפתח עם ההרשאה המתאימה.",
      "detailMessage": "חסרה הרשאה במפתח.",
      "path": [
        "header",
        "Authorization"
      ],
      "helpArticle": "roles-and-permissions"
    },
    {
      "detail": "API_KEY_IP_REFUSED",
      "code": "FORBIDDEN",
      "status": 403,
      "message": "הבקשה הגיעה מכתובת שלא נמצאת ברשימת הכתובות של המפתח.",
      "detailMessage": "הכתובת לא ברשימה של המפתח.",
      "path": [
        "header",
        "Authorization"
      ],
      "helpArticle": "roles-and-permissions"
    },
    {
      "detail": "API_KEY_BROWSER_REFUSED",
      "code": "FORBIDDEN",
      "status": 403,
      "message": "מפתח מיועד לשרת, לא לדפדפן. אין לשים אותו בדף אינטרנט.",
      "detailMessage": "בקשה מדפדפן עם מפתח.",
      "path": [
        "header",
        "Authorization"
      ],
      "helpArticle": "roles-and-permissions"
    },
    {
      "detail": "API_KEY_ISSUING_CREATOR_NOT_OWNER",
      "code": "FORBIDDEN",
      "status": 403,
      "message": "מי שיצר את המפתח כבר לא הבעלים של העסק, ולכן המפתח לא מפיק מסמכים. הבעלים של העסק יכולים ליצור מפתח חדש.",
      "detailMessage": "מי שיצר את המפתח כבר לא הבעלים של העסק.",
      "path": [
        "header",
        "Authorization"
      ],
      "helpArticle": "api-issue-documents"
    },
    {
      "detail": "API_KEY_ISSUING_NOT_ALLOWED",
      "code": "FORBIDDEN",
      "status": 403,
      "message": "כדי להפיק מסמכים דרך מפתח צריך חיבור פעיל לרשות המסים. עוסק פטור בלי חיבור יכול להפיק דרך מפתח 30 ימים אחרי שהעסק נפתח במערכת.",
      "detailMessage": "לעסק עוד אין את התנאים להפקה דרך מפתח.",
      "path": [
        "header",
        "Authorization"
      ],
      "helpArticle": "api-issue-documents"
    },
    {
      "detail": "API_KEY_ISSUING_TYPE_REFUSED",
      "code": "FORBIDDEN",
      "status": 403,
      "message": "את המסמך הזה אי אפשר להפיק דרך מפתח, אבל אפשר להפיק אותו באפליקציה. דרך מפתח מפיקים רק חשבוניות מס, חשבוניות מס / קבלה, קבלות, חשבוניות זיכוי וחשבונות עסקה, ורק בגרסה הרגילה שלהם: בלי קבלה על פיקדון, חשבונית עצמית, חשבונית משלימה או זיכוי בשל חוב אבוד, ובלי בקשת אישור הקצאה לחשבון עסקה.",
      "detailMessage": "את המסמך הזה לא מפיקים דרך מפתח.",
      "path": [
        "params",
        "documentId"
      ],
      "helpArticle": "api-issue-documents"
    },
    {
      "detail": "API_KEY_ISSUING_DATE_TODAY",
      "code": "VALIDATION_FAILED",
      "status": 400,
      "message": "דרך מפתח מפיקים מסמך רק בתאריך של היום. צריך לשלוח את התאריך של היום בשעון ישראל.",
      "detailMessage": "תאריך המסמך צריך להיות היום.",
      "path": [
        "body",
        "documentDate"
      ],
      "helpArticle": "api-issue-documents"
    },
    {
      "detail": "API_KEY_DRAFT_ID_RESERVED",
      "code": "VALIDATION_FAILED",
      "status": 400,
      "message": "המזהה הזה מיועד לטיוטות שהמערכת מכינה בעצמה, כמו הטיוטות של מסמך קבוע. יוצרים את הטיוטה עם מזהה אקראי חדש.",
      "detailMessage": "המזהה מיועד לטיוטות שהמערכת מכינה בעצמה.",
      "path": [
        "params",
        "documentId"
      ],
      "helpArticle": "api-issue-documents"
    },
    {
      "detail": "API_KEY_SENDING_NOT_ALLOWED",
      "code": "FORBIDDEN",
      "status": 403,
      "message": "כדי לשלוח מסמכים דרך מפתח צריך חיבור פעיל לרשות המסים. עוסק פטור בלי חיבור יכול לשלוח דרך מפתח 30 ימים אחרי שהעסק נפתח במערכת.",
      "detailMessage": "לעסק עוד אין את התנאים לשליחה דרך מפתח.",
      "path": [
        "header",
        "Authorization"
      ],
      "helpArticle": "api-send-documents",
      "routes": [
        "delivery.sendToCustomer"
      ]
    },
    {
      "detail": "GMAIL_SOURCED_FILE",
      "code": "FORBIDDEN",
      "status": 403,
      "message": "את הקובץ הזה אי אפשר לפתוח עם מפתח, כי הוא הגיע מ-Gmail. אפשר לפתוח אותו באפליקציה.",
      "detailMessage": "קובץ שהגיע מ-Gmail.",
      "path": [],
      "helpArticle": "roles-and-permissions",
      "routes": [
        "expenses.getAttachmentLink"
      ]
    }
  ],
  "x-rate-limits": {
    "perKey": {
      "burst": 20,
      "burstWindowSeconds": 10,
      "perMinute": 120,
      "perDay": 20000
    },
    "perBusiness": {
      "perMinute": 240,
      "perDay": 50000
    },
    "writesPerKeyMinute": 60,
    "heavyPerKeyMinute": 10,
    "queuedExportsPerBusiness": 3,
    "failedAuthPerAddress": 20,
    "failedAuthWindowMinutes": 10,
    "failedAuthBlockMinutes": 60,
    "headers": [
      "RateLimit-Limit",
      "RateLimit-Remaining",
      "RateLimit-Reset"
    ]
  },
  "x-request-limits": {
    "maxBodyBytes": 1048576
  },
  "x-withheld": {
    "reportKinds": [
      "permanent_file_journal",
      "consent_register"
    ]
  }
}
