{
  "openapi": "3.1.1",
  "info": {
    "title": "Eternify Ledger API: Sales",
    "version": "v1",
    "x-wire-version": "2026-08-31",
    "description": "Customers, invoices, receipts and receivables. The same operations the Eternify Ledger app and its connected AI tools use, over HTTPS and JSON. Send a key or an access token as a bearer token. Each operation is stable or beta: a stable operation changes only with 365 days' notice, a beta one with 30. Changes are listed in the changelog at https://www.eternifylabs.com/resources/developers/changelog.",
    "contact": {
      "name": "Eternify Labs developer resources",
      "url": "https://www.eternifylabs.com/resources/developers"
    }
  },
  "servers": [
    {
      "url": "https://api.eternifylabs.com",
      "description": "Production"
    }
  ],
  "security": [
    {
      "apiKey": []
    },
    {
      "oauth": []
    }
  ],
  "tags": [
    {
      "name": "sales",
      "description": "Customers, invoices, receipts and receivables.",
      "x-display-name": "Sales"
    }
  ],
  "paths": {
    "/v1/contracts": {
      "get": {
        "operationId": "listContracts",
        "summary": "Lists the customer contracts, with the server's total.",
        "description": "Lists the customer contracts, with the server's total. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "entityId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "customerId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            }
          },
          {
            "name": "nextFrom",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
            }
          },
          {
            "name": "nextTo",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
            }
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            }
          },
          {
            "name": "poMismatch",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "yes",
                "no"
              ]
            }
          },
          {
            "name": "cf",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 4000
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 512
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "entityId": {
                            "type": "string"
                          },
                          "entityName": {
                            "type": "string"
                          },
                          "entityTimeZone": {
                            "type": "string"
                          },
                          "kind": {
                            "type": "string",
                            "enum": [
                              "CONTRACT",
                              "REPEAT"
                            ]
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "DRAFT",
                              "ACTIVE",
                              "COMPLETED",
                              "CANCELLED"
                            ]
                          },
                          "customer": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "displayName": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "id",
                                  "displayName"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "customerName": {
                            "type": "string"
                          },
                          "externalRef": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "currency": {
                            "type": "string"
                          },
                          "startDate": {
                            "type": "string",
                            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                          },
                          "endDate": {
                            "anyOf": [
                              {
                                "type": "string",
                                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "billingFrequency": {
                            "anyOf": [
                              {
                                "type": "string",
                                "enum": [
                                  "MONTHLY",
                                  "QUARTERLY",
                                  "YEARLY",
                                  "ONCE_AT_END"
                                ]
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "firstBillingDate": {
                            "anyOf": [
                              {
                                "type": "string",
                                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "lastBillingDate": {
                            "anyOf": [
                              {
                                "type": "string",
                                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "perPeriodAmountMinor": {
                            "anyOf": [
                              {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "totalValueMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "nextBillingDate": {
                            "anyOf": [
                              {
                                "type": "string",
                                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "billedRows": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          },
                          "rowCount": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          },
                          "customerPo": {
                            "$ref": "#/components/schemas/CustomerPo"
                          },
                          "invoicedMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "remainingMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "poDifferenceMinor": {
                            "anyOf": [
                              {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          }
                        },
                        "required": [
                          "id",
                          "entityId",
                          "entityName",
                          "entityTimeZone",
                          "kind",
                          "status",
                          "customer",
                          "customerName",
                          "externalRef",
                          "currency",
                          "startDate",
                          "endDate",
                          "billingFrequency",
                          "firstBillingDate",
                          "lastBillingDate",
                          "perPeriodAmountMinor",
                          "totalValueMinor",
                          "nextBillingDate",
                          "billedRows",
                          "rowCount"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "total": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "data",
                    "nextCursor",
                    "total"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      },
      "post": {
        "operationId": "createContract",
        "summary": "Creates a draft contract with a customer.",
        "description": "Creates a draft contract with a customer. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "billingFrequency": {
                    "type": "string",
                    "enum": [
                      "MONTHLY",
                      "QUARTERLY",
                      "YEARLY",
                      "ONCE_AT_END"
                    ]
                  },
                  "billingDayOfMonth": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 31
                  },
                  "firstBillingDate": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  },
                  "lastBillingDate": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  },
                  "perPeriodAmountMinor": {
                    "type": "string",
                    "pattern": "^-?\\d+$"
                  },
                  "totalValueMinor": {
                    "type": "string",
                    "pattern": "^-?\\d+$"
                  },
                  "customerPoNumber": {
                    "type": "string",
                    "maxLength": 120
                  },
                  "customerPoAmountMinor": {
                    "type": "string",
                    "pattern": "^-?\\d+$"
                  },
                  "customerPoTaxInclusive": {
                    "type": "boolean"
                  },
                  "customerPoDocumentId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "entityId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "customerId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "externalRef": {
                    "type": "string",
                    "maxLength": 200
                  },
                  "startDate": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  },
                  "endDate": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  },
                  "currency": {
                    "type": "string",
                    "pattern": "^[A-Z]{3}$"
                  },
                  "lines": {
                    "$ref": "#/components/schemas/Lines9"
                  },
                  "templateInvoiceId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "customFields": {
                    "$ref": "#/components/schemas/CustomFields"
                  },
                  "milestones": {
                    "$ref": "#/components/schemas/Milestones"
                  },
                  "holdbackBp": {
                    "anyOf": [
                      {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 10000
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "holdbackReleaseDueOn": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "billingFrequency",
                  "firstBillingDate",
                  "lastBillingDate",
                  "entityId",
                  "customerId",
                  "startDate",
                  "lines"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "Ledger-Position": {
                "$ref": "#/components/headers/LedgerPosition"
              },
              "Location": {
                "$ref": "#/components/headers/Location"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreateContractResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem400"
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "409": {
            "$ref": "#/components/responses/Problem409"
          },
          "412": {
            "$ref": "#/components/responses/Problem412"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/contracts/billing-rows": {
      "get": {
        "operationId": "listBillingRows",
        "summary": "Lists the billing rows the contracts produce each period.",
        "description": "Lists the billing rows the contracts produce each period. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "entityId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "contractId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            }
          },
          {
            "name": "billingFrom",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
            }
          },
          {
            "name": "billingTo",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 512
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "position": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "SCHEDULED",
                              "DUE",
                              "DRAFTED",
                              "BILLED",
                              "SKIPPED"
                            ]
                          },
                          "billingDate": {
                            "type": "string",
                            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                          },
                          "periodStart": {
                            "type": "string",
                            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                          },
                          "periodEnd": {
                            "type": "string",
                            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                          },
                          "amountMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "invoice": {
                            "$ref": "#/components/schemas/Invoice2"
                          },
                          "skippedBy": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "name": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "id",
                                  "name"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "skippedAt": {
                            "anyOf": [
                              {
                                "type": "string",
                                "minLength": 20
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "skipReason": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "contractId": {
                            "type": "string"
                          },
                          "entityId": {
                            "type": "string"
                          },
                          "entityName": {
                            "type": "string"
                          },
                          "customer": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "displayName": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "id",
                                  "displayName"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "customerName": {
                            "type": "string"
                          },
                          "currency": {
                            "type": "string"
                          },
                          "blockedReason": {
                            "type": [
                              "string",
                              "null"
                            ]
                          }
                        },
                        "required": [
                          "id",
                          "position",
                          "status",
                          "billingDate",
                          "periodStart",
                          "periodEnd",
                          "amountMinor",
                          "invoice",
                          "skippedBy",
                          "skippedAt",
                          "skipReason",
                          "contractId",
                          "entityId",
                          "entityName",
                          "customer",
                          "customerName",
                          "currency",
                          "blockedReason"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "total": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "data",
                    "nextCursor",
                    "total"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/contracts/change-proposals": {
      "get": {
        "operationId": "listBillingChangeProposals",
        "summary": "Lists the proposed changes to contract billing, waiting for a decision.",
        "description": "Lists the proposed changes to contract billing, waiting for a decision. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "entityId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 512
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "proposalId": {
                            "type": "string"
                          },
                          "contractId": {
                            "type": "string"
                          },
                          "entityId": {
                            "type": "string"
                          },
                          "entityName": {
                            "type": "string"
                          },
                          "customerName": {
                            "type": "string"
                          },
                          "currency": {
                            "type": "string"
                          },
                          "reason": {
                            "type": "string"
                          },
                          "submittedBy": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "name": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "id",
                                  "name"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "submittedAt": {
                            "type": "string",
                            "minLength": 20
                          },
                          "changeCount": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          },
                          "kinds": {
                            "type": "array",
                            "items": {
                              "type": "string",
                              "enum": [
                                "SKIP",
                                "MOVE",
                                "REAMOUNT",
                                "ADD"
                              ]
                            }
                          },
                          "proposedTotalMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          }
                        },
                        "required": [
                          "proposalId",
                          "contractId",
                          "entityId",
                          "entityName",
                          "customerName",
                          "currency",
                          "reason",
                          "submittedBy",
                          "submittedAt",
                          "changeCount",
                          "kinds",
                          "proposedTotalMinor"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "total": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "data",
                    "nextCursor",
                    "total"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/contracts/{contractId}": {
      "get": {
        "operationId": "getContract",
        "summary": "Returns one contract with its schedule and status.",
        "description": "Returns one contract with its schedule and status. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "contractId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreateContractResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "404": {
            "$ref": "#/components/responses/Problem404"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      },
      "patch": {
        "operationId": "updateContract",
        "summary": "Changes a draft contract.",
        "description": "Changes a draft contract. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "contractId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "billingFrequency": {
                    "type": "string",
                    "enum": [
                      "MONTHLY",
                      "QUARTERLY",
                      "YEARLY",
                      "ONCE_AT_END"
                    ]
                  },
                  "billingDayOfMonth": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 31
                  },
                  "firstBillingDate": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  },
                  "lastBillingDate": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  },
                  "perPeriodAmountMinor": {
                    "type": "string",
                    "pattern": "^-?\\d+$"
                  },
                  "totalValueMinor": {
                    "type": "string",
                    "pattern": "^-?\\d+$"
                  },
                  "customerPoNumber": {
                    "type": "string",
                    "maxLength": 120
                  },
                  "customerPoAmountMinor": {
                    "type": "string",
                    "pattern": "^-?\\d+$"
                  },
                  "customerPoTaxInclusive": {
                    "type": "boolean"
                  },
                  "customerPoDocumentId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "customerId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "externalRef": {
                    "type": "string",
                    "maxLength": 200
                  },
                  "startDate": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  },
                  "endDate": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "lines": {
                    "$ref": "#/components/schemas/Lines9"
                  },
                  "customFields": {
                    "$ref": "#/components/schemas/CustomFields6"
                  },
                  "milestones": {
                    "$ref": "#/components/schemas/Milestones"
                  },
                  "holdbackBp": {
                    "anyOf": [
                      {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 10000
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "holdbackReleaseDueOn": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "Ledger-Position": {
                "$ref": "#/components/headers/LedgerPosition"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreateContractResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem400"
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "404": {
            "$ref": "#/components/responses/Problem404"
          },
          "409": {
            "$ref": "#/components/responses/Problem409"
          },
          "412": {
            "$ref": "#/components/responses/Problem412"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      },
      "delete": {
        "operationId": "discardContract",
        "summary": "Discards a draft contract that has not been approved.",
        "description": "Discards a draft contract that has not been approved. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "contractId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "Ledger-Position": {
                "$ref": "#/components/headers/LedgerPosition"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "customerName": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "id",
                    "customerName"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem400"
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "404": {
            "$ref": "#/components/responses/Problem404"
          },
          "409": {
            "$ref": "#/components/responses/Problem409"
          },
          "412": {
            "$ref": "#/components/responses/Problem412"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/contracts/{contractId}/approve": {
      "post": {
        "operationId": "approveContract",
        "summary": "Approves a contract so it can be billed.",
        "description": "Approves a contract so it can be billed. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:approve",
        "parameters": [
          {
            "name": "contractId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "note": {
                    "type": "string",
                    "maxLength": 500
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "Ledger-Position": {
                "$ref": "#/components/headers/LedgerPosition"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreateContractResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem400"
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "404": {
            "$ref": "#/components/responses/Problem404"
          },
          "409": {
            "$ref": "#/components/responses/Problem409"
          },
          "412": {
            "$ref": "#/components/responses/Problem412"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/contracts/{contractId}/cancel": {
      "post": {
        "operationId": "cancelContract",
        "summary": "Cancels a contract so it stops billing.",
        "description": "Cancels a contract so it stops billing. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:approve",
        "parameters": [
          {
            "name": "contractId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "reason": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 500
                  }
                },
                "required": [
                  "reason"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "Ledger-Position": {
                "$ref": "#/components/headers/LedgerPosition"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreateContractResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem400"
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "404": {
            "$ref": "#/components/responses/Problem404"
          },
          "409": {
            "$ref": "#/components/responses/Problem409"
          },
          "412": {
            "$ref": "#/components/responses/Problem412"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/contracts/{contractId}/customer-po": {
      "put": {
        "operationId": "updateContractCustomerPo",
        "summary": "Records the customer purchase order number on a contract.",
        "description": "Records the customer purchase order number on a contract. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "contractId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "customerPoNumber": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 120
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "customerPoAmountMinor": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^-?\\d+$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "customerPoTaxInclusive": {
                    "type": "boolean"
                  },
                  "customerPoDocumentId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "customerPoNumber",
                  "customerPoAmountMinor",
                  "customerPoTaxInclusive"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "Ledger-Position": {
                "$ref": "#/components/headers/LedgerPosition"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreateContractResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem400"
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "404": {
            "$ref": "#/components/responses/Problem404"
          },
          "409": {
            "$ref": "#/components/responses/Problem409"
          },
          "412": {
            "$ref": "#/components/responses/Problem412"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/contracts/{contractId}/holdback-release": {
      "post": {
        "operationId": "releaseContractHoldback",
        "summary": "Proposes releasing the holdback of a contract.",
        "description": "Proposes releasing the holdback of a contract. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "contractId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "amountMinor": {
                    "type": "string",
                    "pattern": "^-?\\d+$"
                  },
                  "issueDate": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "Ledger-Position": {
                "$ref": "#/components/headers/LedgerPosition"
              },
              "Location": {
                "$ref": "#/components/headers/Location"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetInvoiceResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem400"
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "404": {
            "$ref": "#/components/responses/Problem404"
          },
          "409": {
            "$ref": "#/components/responses/Problem409"
          },
          "412": {
            "$ref": "#/components/responses/Problem412"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/contracts/{contractId}/invoice-lines": {
      "get": {
        "operationId": "getContractInvoiceLines",
        "summary": "Returns the invoice lines a contract produces.",
        "description": "Returns the invoice lines a contract produces. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "contractId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "basis",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "AMOUNT",
                "PERCENT",
                "LINES",
                "MILESTONE",
                "PERCENT_COMPLETE",
                "HOLDBACK_RELEASE"
              ]
            }
          },
          {
            "name": "amountMinor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^-?\\d+$"
            }
          },
          {
            "name": "percentBp",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 10000
            }
          },
          {
            "name": "milestoneId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "percentCompleteBp",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 10000
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "contractId": {
                      "type": "string"
                    },
                    "contractBillingBasis": {
                      "type": "string",
                      "enum": [
                        "SCHEDULE",
                        "AMOUNT",
                        "PERCENT",
                        "LINES",
                        "MILESTONE",
                        "PERCENT_COMPLETE",
                        "HOLDBACK_RELEASE"
                      ]
                    },
                    "contractMilestoneId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "percentCompleteBp": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 10000
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "currency": {
                      "type": "string",
                      "pattern": "^[A-Z]{3}$"
                    },
                    "lines": {
                      "minItems": 1,
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "description": {
                            "type": "string"
                          },
                          "quantity": {
                            "type": "string"
                          },
                          "unitPriceMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "netMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "productId": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "accountId": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "chargeKind": {
                            "anyOf": [
                              {
                                "type": "string",
                                "enum": [
                                  "FREIGHT",
                                  "FREIGHT_INSURANCE",
                                  "HOLDBACK_WITHHELD",
                                  "HOLDBACK_RELEASE"
                                ]
                              },
                              {
                                "type": "null"
                              }
                            ]
                          }
                        },
                        "required": [
                          "description",
                          "quantity",
                          "unitPriceMinor",
                          "netMinor",
                          "productId",
                          "accountId",
                          "chargeKind"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "figures": {
                      "type": "object",
                      "properties": {
                        "contractValueMinor": {
                          "type": "string",
                          "pattern": "^-?\\d+$"
                        },
                        "billedMinor": {
                          "type": "string",
                          "pattern": "^-?\\d+$"
                        },
                        "holdbackWithheldMinor": {
                          "type": "string",
                          "pattern": "^-?\\d+$"
                        },
                        "taxableMinor": {
                          "type": "string",
                          "pattern": "^-?\\d+$"
                        },
                        "invoicedToDateMinor": {
                          "type": "string",
                          "pattern": "^-?\\d+$"
                        },
                        "remainingAfterMinor": {
                          "type": "string",
                          "pattern": "^-?\\d+$"
                        },
                        "percentCompleteBpAfter": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "holdbackHeldAfterMinor": {
                          "type": "string",
                          "pattern": "^-?\\d+$"
                        }
                      },
                      "required": [
                        "contractValueMinor",
                        "billedMinor",
                        "holdbackWithheldMinor",
                        "taxableMinor",
                        "invoicedToDateMinor",
                        "remainingAfterMinor",
                        "percentCompleteBpAfter",
                        "holdbackHeldAfterMinor"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "contractId",
                    "contractBillingBasis",
                    "contractMilestoneId",
                    "percentCompleteBp",
                    "currency",
                    "lines",
                    "figures"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "404": {
            "$ref": "#/components/responses/Problem404"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/contracts/{contractId}/invoices": {
      "post": {
        "operationId": "draftContractInvoice",
        "summary": "Drafts an invoice from a contract's billing schedule.",
        "description": "Drafts an invoice from a contract's billing schedule. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "contractId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "basis": {
                    "type": "string",
                    "enum": [
                      "AMOUNT",
                      "PERCENT",
                      "LINES",
                      "MILESTONE",
                      "PERCENT_COMPLETE",
                      "HOLDBACK_RELEASE"
                    ]
                  },
                  "amountMinor": {
                    "type": "string",
                    "pattern": "^-?\\d+$"
                  },
                  "percentBp": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 10000
                  },
                  "milestoneId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "percentCompleteBp": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 10000
                  },
                  "issueDate": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  }
                },
                "required": [
                  "basis"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "Ledger-Position": {
                "$ref": "#/components/headers/LedgerPosition"
              },
              "Location": {
                "$ref": "#/components/headers/Location"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetInvoiceResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem400"
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "404": {
            "$ref": "#/components/responses/Problem404"
          },
          "409": {
            "$ref": "#/components/responses/Problem409"
          },
          "412": {
            "$ref": "#/components/responses/Problem412"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/contracts/{contractId}/milestones/{milestoneId}/reached": {
      "post": {
        "operationId": "markContractMilestoneReached",
        "summary": "Records that a contract milestone was reached, which allows its billing.",
        "description": "Records that a contract milestone was reached, which allows its billing. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:approve",
        "parameters": [
          {
            "name": "contractId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "milestoneId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "reachedOn": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  },
                  "note": {
                    "type": "string",
                    "maxLength": 500
                  }
                },
                "required": [
                  "reachedOn"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "Ledger-Position": {
                "$ref": "#/components/headers/LedgerPosition"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreateContractResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem400"
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "404": {
            "$ref": "#/components/responses/Problem404"
          },
          "409": {
            "$ref": "#/components/responses/Problem409"
          },
          "412": {
            "$ref": "#/components/responses/Problem412"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/contracts/{contractId}/schedule": {
      "post": {
        "operationId": "proposeBillingChange",
        "summary": "Proposes a change to a contract's billing schedule, for a person to decide.",
        "description": "Proposes a change to a contract's billing schedule, for a person to decide. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "contractId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "changes": {
                    "minItems": 1,
                    "maxItems": 50,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "kind": {
                          "type": "string",
                          "enum": [
                            "SKIP",
                            "MOVE",
                            "REAMOUNT",
                            "ADD"
                          ]
                        },
                        "position": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "reason": {
                          "type": "string",
                          "maxLength": 500
                        },
                        "billingDate": {
                          "type": "string",
                          "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                        },
                        "periodStart": {
                          "type": "string",
                          "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                        },
                        "periodEnd": {
                          "type": "string",
                          "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                        },
                        "amountMinor": {
                          "type": "string",
                          "pattern": "^-?\\d+$"
                        }
                      },
                      "required": [
                        "kind",
                        "position"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "reason": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 500
                  }
                },
                "required": [
                  "changes",
                  "reason"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "Ledger-Position": {
                "$ref": "#/components/headers/LedgerPosition"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreateContractResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem400"
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "404": {
            "$ref": "#/components/responses/Problem404"
          },
          "409": {
            "$ref": "#/components/responses/Problem409"
          },
          "412": {
            "$ref": "#/components/responses/Problem412"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/contracts/{contractId}/schedule/decide": {
      "post": {
        "operationId": "decideBillingChange",
        "summary": "Accepts or declines a proposed change to a contract's billing schedule.",
        "description": "Accepts or declines a proposed change to a contract's billing schedule. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:approve",
        "parameters": [
          {
            "name": "contractId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "outcome": {
                    "type": "string",
                    "enum": [
                      "APPROVED",
                      "DECLINED"
                    ]
                  },
                  "note": {
                    "type": "string",
                    "maxLength": 500
                  }
                },
                "required": [
                  "outcome"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "Ledger-Position": {
                "$ref": "#/components/headers/LedgerPosition"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreateContractResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem400"
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "404": {
            "$ref": "#/components/responses/Problem404"
          },
          "409": {
            "$ref": "#/components/responses/Problem409"
          },
          "412": {
            "$ref": "#/components/responses/Problem412"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/credit-policy": {
      "get": {
        "operationId": "getCreditPolicy",
        "summary": "Returns the credit policy the ledger applies to customers.",
        "description": "Returns the credit policy the ledger applies to customers. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [],
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "version": {
                      "type": "string"
                    },
                    "windowMonths": {
                      "type": "integer",
                      "exclusiveMinimum": 0,
                      "maximum": 9007199254740991
                    },
                    "writeOffWindowMonths": {
                      "type": "integer",
                      "exclusiveMinimum": 0,
                      "maximum": 9007199254740991
                    },
                    "bandFloors": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "band": {
                            "type": "string",
                            "enum": [
                              "A",
                              "B",
                              "C",
                              "D",
                              "E"
                            ]
                          },
                          "minScore": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 100
                          }
                        },
                        "required": [
                          "band",
                          "minScore"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "factors": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "code": {
                            "type": "string",
                            "enum": [
                              "LATENESS",
                              "ON_TIME_SHARE",
                              "OVERDUE_SHARE",
                              "LIMIT_USE",
                              "RETURNED_PAYMENTS",
                              "DISPUTES"
                            ]
                          },
                          "label": {
                            "type": "string"
                          },
                          "cap": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "rule": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "code",
                          "label",
                          "cap",
                          "rule"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "caps": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "code": {
                            "type": "string",
                            "enum": [
                              "WRITE_OFF",
                              "OVER_90"
                            ]
                          },
                          "sentence": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "code",
                          "sentence"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "consequences": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "band": {
                            "type": "string",
                            "enum": [
                              "A",
                              "B",
                              "C",
                              "D",
                              "E",
                              "N"
                            ]
                          },
                          "sentence": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "band",
                          "sentence"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "thinFileRule": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "version",
                    "windowMonths",
                    "writeOffWindowMonths",
                    "bandFloors",
                    "factors",
                    "caps",
                    "consequences",
                    "thinFileRule"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/customer-proposals": {
      "get": {
        "operationId": "listCustomerProposals",
        "summary": "Lists the customers proposed from outside documents, waiting for a decision.",
        "description": "Lists the customers proposed from outside documents, waiting for a decision. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "default": 10,
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 512
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "proposalId": {
                            "type": "string"
                          },
                          "source": {
                            "type": "string",
                            "enum": [
                              "DIALOG",
                              "IMPORT",
                              "INTAKE"
                            ]
                          },
                          "customer": {
                            "type": "object",
                            "properties": {
                              "displayName": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 200
                              },
                              "legalName": {
                                "type": "string",
                                "maxLength": 200
                              },
                              "country": {
                                "default": "CA",
                                "type": "string",
                                "pattern": "^[A-Z]{2}$"
                              },
                              "region": {
                                "type": "string",
                                "pattern": "^(CA|US)-[A-Z]{2}$"
                              },
                              "email": {
                                "type": "string",
                                "maxLength": 200
                              },
                              "phone": {
                                "type": "string",
                                "maxLength": 50
                              },
                              "address": {
                                "type": "string",
                                "maxLength": 500
                              },
                              "notes": {
                                "type": "string",
                                "maxLength": 2000
                              },
                              "website": {
                                "type": "string",
                                "maxLength": 300,
                                "pattern": "^https?:\\/\\/\\S+$"
                              },
                              "language": {
                                "type": "string",
                                "enum": [
                                  "en",
                                  "fr"
                                ]
                              },
                              "gstHstNumber": {
                                "type": "string",
                                "maxLength": 32,
                                "pattern": "^[0-9]{9}RT[0-9]{4}$"
                              },
                              "qstNumber": {
                                "type": "string",
                                "maxLength": 32,
                                "pattern": "^[0-9]{10}TQ[0-9]{4}$"
                              },
                              "pstNumber": {
                                "type": "string",
                                "maxLength": 32,
                                "pattern": "^PST-[0-9]{4}-[0-9]{4}$"
                              },
                              "billingAddress": {
                                "type": "string",
                                "maxLength": 500
                              },
                              "paymentTermsId": {
                                "type": "string",
                                "minLength": 1
                              },
                              "contacts": {
                                "$ref": "#/components/schemas/Contacts"
                              },
                              "addresses": {
                                "maxItems": 50,
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "line1": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 200
                                    },
                                    "line2": {
                                      "type": "string",
                                      "maxLength": 200
                                    },
                                    "city": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 120
                                    },
                                    "region": {
                                      "type": "string",
                                      "maxLength": 5
                                    },
                                    "postalCode": {
                                      "type": "string",
                                      "maxLength": 20
                                    },
                                    "country": {
                                      "default": "CA",
                                      "type": "string",
                                      "pattern": "^[A-Z]{2}$"
                                    },
                                    "placeId": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 300
                                    },
                                    "label": {
                                      "type": "string",
                                      "maxLength": 80
                                    },
                                    "kind": {
                                      "type": "string",
                                      "enum": [
                                        "BILLING",
                                        "SHIP_TO"
                                      ]
                                    },
                                    "isDefault": {
                                      "type": "boolean"
                                    },
                                    "onReserve": {
                                      "type": "boolean"
                                    }
                                  },
                                  "required": [
                                    "line1",
                                    "city",
                                    "country",
                                    "kind"
                                  ],
                                  "additionalProperties": false
                                }
                              },
                              "externalRef": {
                                "$ref": "#/components/schemas/ExternalRef"
                              },
                              "parentCustomerId": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 64
                              },
                              "invoicesToParent": {
                                "type": "boolean"
                              },
                              "relatedParty": {
                                "type": "boolean"
                              },
                              "relatedPartyNote": {
                                "type": "string",
                                "maxLength": 500
                              },
                              "businessNumber": {
                                "type": "string",
                                "maxLength": 32,
                                "pattern": "^[0-9]{9}$"
                              },
                              "corporation": {
                                "$ref": "#/components/schemas/Corporation"
                              },
                              "defaultCurrency": {
                                "type": "string",
                                "pattern": "^[A-Z]{3}$"
                              },
                              "defaultEntityId": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 64
                              },
                              "defaultDepartmentValueId": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 64
                              },
                              "creditInsurance": {
                                "$ref": "#/components/schemas/CreditInsurance"
                              },
                              "customFields": {
                                "$ref": "#/components/schemas/CustomFields"
                              },
                              "taxStatus": {
                                "type": "string",
                                "enum": [
                                  "STANDARD",
                                  "INDIAN_ACT_S87_RELIEF"
                                ]
                              }
                            },
                            "required": [
                              "displayName",
                              "country"
                            ],
                            "additionalProperties": false
                          },
                          "nearMatches": {
                            "type": "object",
                            "properties": {
                              "rows": {
                                "$ref": "#/components/schemas/Rows"
                              },
                              "total": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              }
                            },
                            "required": [
                              "rows",
                              "total"
                            ],
                            "additionalProperties": false
                          },
                          "submittedBy": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "name": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "id",
                                  "name"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "submittedAt": {
                            "type": "string",
                            "minLength": 20
                          },
                          "intakeLink": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "label": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "id",
                                  "label"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "document": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "fileName": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "id",
                                  "fileName"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "importId": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "importLine": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "exclusiveMinimum": 0,
                                "maximum": 9007199254740991
                              },
                              {
                                "type": "null"
                              }
                            ]
                          }
                        },
                        "required": [
                          "proposalId",
                          "source",
                          "customer",
                          "nearMatches",
                          "submittedBy",
                          "submittedAt",
                          "intakeLink",
                          "document",
                          "importId",
                          "importLine"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "total": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "data",
                    "nextCursor",
                    "total"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/customer-proposals/{proposalId}/approve": {
      "post": {
        "operationId": "approveCustomerProposal",
        "summary": "Approves a proposed customer, which creates the customer record.",
        "description": "Approves a proposed customer, which creates the customer record. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:approve",
        "parameters": [
          {
            "name": "proposalId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "note": {
                    "type": "string",
                    "maxLength": 1000
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "Ledger-Position": {
                "$ref": "#/components/headers/LedgerPosition"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApproveCustomerProposalResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem400"
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "404": {
            "$ref": "#/components/responses/Problem404"
          },
          "409": {
            "$ref": "#/components/responses/Problem409"
          },
          "412": {
            "$ref": "#/components/responses/Problem412"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/customer-proposals/{proposalId}/reject": {
      "post": {
        "operationId": "rejectCustomerProposal",
        "summary": "Rejects a proposed customer with a reason.",
        "description": "Rejects a proposed customer with a reason. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:approve",
        "parameters": [
          {
            "name": "proposalId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "reason": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 1000
                  }
                },
                "required": [
                  "reason"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "Ledger-Position": {
                "$ref": "#/components/headers/LedgerPosition"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApproveCustomerProposalResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem400"
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "404": {
            "$ref": "#/components/responses/Problem404"
          },
          "409": {
            "$ref": "#/components/responses/Problem409"
          },
          "412": {
            "$ref": "#/components/responses/Problem412"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/customers": {
      "get": {
        "operationId": "listCustomers",
        "summary": "Lists the customers on the ledger, with the server's total.",
        "description": "Lists the customers on the ledger, with the server's total. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "ACTIVE",
                "ARCHIVED"
              ]
            }
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            }
          },
          {
            "name": "region",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^(CA|US)-[A-Z]{2}$"
            }
          },
          {
            "name": "language",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "en",
                "fr"
              ]
            }
          },
          {
            "name": "termsId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "balanceFromMinor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^-?\\d+$"
            }
          },
          {
            "name": "balanceToMinor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^-?\\d+$"
            }
          },
          {
            "name": "lastInvoiceFrom",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
            }
          },
          {
            "name": "lastInvoiceTo",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
            }
          },
          {
            "name": "held",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "yes",
                "no"
              ]
            }
          },
          {
            "name": "overLimit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "yes"
              ]
            }
          },
          {
            "name": "rating",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            }
          },
          {
            "name": "linked",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "yes",
                "no"
              ]
            }
          },
          {
            "name": "relatedParty",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "yes",
                "no"
              ]
            }
          },
          {
            "name": "family",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          },
          {
            "name": "topLevel",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "yes"
              ]
            }
          },
          {
            "name": "sort",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "name",
                "owed",
                "pastDue",
                "lastInvoice"
              ]
            }
          },
          {
            "name": "dir",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "asc",
                "desc"
              ]
            }
          },
          {
            "name": "cf",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 4000
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 512
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ArchiveCustomerResponse"
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "total": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "data",
                    "nextCursor",
                    "total"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      },
      "post": {
        "operationId": "createCustomer",
        "summary": "Creates a customer on the ledger.",
        "description": "Creates a customer on the ledger. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "displayName": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "legalName": {
                    "type": "string",
                    "maxLength": 200
                  },
                  "country": {
                    "default": "CA",
                    "type": "string",
                    "pattern": "^[A-Z]{2}$"
                  },
                  "region": {
                    "type": "string",
                    "pattern": "^(CA|US)-[A-Z]{2}$"
                  },
                  "email": {
                    "type": "string",
                    "maxLength": 200
                  },
                  "phone": {
                    "type": "string",
                    "maxLength": 50
                  },
                  "address": {
                    "type": "string",
                    "maxLength": 500
                  },
                  "notes": {
                    "type": "string",
                    "maxLength": 2000
                  },
                  "website": {
                    "type": "string",
                    "maxLength": 300,
                    "pattern": "^https?:\\/\\/\\S+$"
                  },
                  "language": {
                    "type": "string",
                    "enum": [
                      "en",
                      "fr"
                    ]
                  },
                  "gstHstNumber": {
                    "type": "string",
                    "maxLength": 32,
                    "pattern": "^[0-9]{9}RT[0-9]{4}$"
                  },
                  "qstNumber": {
                    "type": "string",
                    "maxLength": 32,
                    "pattern": "^[0-9]{10}TQ[0-9]{4}$"
                  },
                  "pstNumber": {
                    "type": "string",
                    "maxLength": 32,
                    "pattern": "^PST-[0-9]{4}-[0-9]{4}$"
                  },
                  "billingAddress": {
                    "type": "string",
                    "maxLength": 500
                  },
                  "paymentTermsId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "contacts": {
                    "$ref": "#/components/schemas/Contacts"
                  },
                  "addresses": {
                    "maxItems": 50,
                    "type": "array",
                    "items": {
                      "$ref": "#/components/schemas/AddressesItem2"
                    }
                  },
                  "externalRef": {
                    "$ref": "#/components/schemas/ExternalRef"
                  },
                  "parentCustomerId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64
                  },
                  "invoicesToParent": {
                    "type": "boolean"
                  },
                  "relatedParty": {
                    "type": "boolean"
                  },
                  "relatedPartyNote": {
                    "type": "string",
                    "maxLength": 500
                  },
                  "businessNumber": {
                    "type": "string",
                    "maxLength": 32,
                    "pattern": "^[0-9]{9}$"
                  },
                  "corporation": {
                    "$ref": "#/components/schemas/Corporation"
                  },
                  "defaultCurrency": {
                    "type": "string",
                    "pattern": "^[A-Z]{3}$"
                  },
                  "defaultEntityId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64
                  },
                  "defaultDepartmentValueId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64
                  },
                  "creditInsurance": {
                    "$ref": "#/components/schemas/CreditInsurance"
                  },
                  "customFields": {
                    "$ref": "#/components/schemas/CustomFields"
                  },
                  "taxStatus": {
                    "type": "string",
                    "enum": [
                      "STANDARD",
                      "INDIAN_ACT_S87_RELIEF"
                    ]
                  }
                },
                "required": [
                  "displayName"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "Ledger-Position": {
                "$ref": "#/components/headers/LedgerPosition"
              },
              "Location": {
                "$ref": "#/components/headers/Location"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreateCustomerResponse"
                }
              }
            }
          },
          "202": {
            "description": "Accepted: the work is done after the answer, or waits for a person's confirmation.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "Ledger-Position": {
                "$ref": "#/components/headers/LedgerPosition"
              },
              "Location": {
                "$ref": "#/components/headers/Location"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreateCustomerResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem400"
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "409": {
            "$ref": "#/components/responses/Problem409"
          },
          "412": {
            "$ref": "#/components/responses/Problem412"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/customers/near-matches": {
      "get": {
        "operationId": "listCustomerNearMatches",
        "summary": "Lists the customers that look like a new one, to avoid duplicates.",
        "description": "Lists the customers that look like a new one, to avoid duplicates. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "displayName",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 200
            }
          },
          {
            "name": "email",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 200
            }
          },
          {
            "name": "gstHstNumber",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 15
            }
          },
          {
            "name": "businessNumber",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 32
            }
          },
          {
            "name": "excludeId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "default": 10,
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 512
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Rows"
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "total": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "data",
                    "nextCursor",
                    "total"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/customers/{customerId}": {
      "get": {
        "operationId": "getCustomer",
        "summary": "Returns one customer with its terms, addresses and status.",
        "description": "Returns one customer with its terms, addresses and status. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "customerId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 512
            }
          },
          {
            "name": "receiptLimit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          },
          {
            "name": "receiptCursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 512
            }
          },
          {
            "name": "creditLimit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          },
          {
            "name": "creditCursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 512
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "customer": {
                      "$ref": "#/components/schemas/ArchiveCustomerResponse"
                    },
                    "openInvoices": {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/components/schemas/Data"
                        },
                        "nextCursor": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "total": {
                          "anyOf": [
                            {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      },
                      "required": [
                        "data",
                        "nextCursor",
                        "total"
                      ],
                      "additionalProperties": false
                    },
                    "recentReceipts": {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "entityId": {
                                "type": "string"
                              },
                              "entityName": {
                                "type": "string"
                              },
                              "customer": {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "displayName": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "id",
                                  "displayName"
                                ],
                                "additionalProperties": false
                              },
                              "receivedOn": {
                                "type": "string",
                                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                              },
                              "amountMinor": {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              "appliedMinor": {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              "unappliedMinor": {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              "currency": {
                                "type": "string",
                                "pattern": "^[A-Z]{3}$"
                              },
                              "method": {
                                "type": "string",
                                "enum": [
                                  "EFT",
                                  "CHEQUE",
                                  "CARD",
                                  "CASH",
                                  "OTHER",
                                  "PAD",
                                  "WIRE",
                                  "DIRECT_DEPOSIT",
                                  "ETRANSFER"
                                ]
                              },
                              "processor": {
                                "anyOf": [
                                  {
                                    "type": "string",
                                    "enum": [
                                      "STRIPE",
                                      "SHOPIFY",
                                      "SQUARE"
                                    ]
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "reference": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "bankAccount": {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "displayName": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "id",
                                  "displayName"
                                ],
                                "additionalProperties": false
                              },
                              "sourceTransactionId": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "entryId": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "entryNumber": {
                                "anyOf": [
                                  {
                                    "type": "integer",
                                    "minimum": -9007199254740991,
                                    "maximum": 9007199254740991
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "entryStatus": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "preGoLive": {
                                "anyOf": [
                                  {
                                    "type": "object",
                                    "properties": {
                                      "goLiveDate": {
                                        "type": "string",
                                        "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                                      }
                                    },
                                    "required": [
                                      "goLiveDate"
                                    ],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "recordedBy": {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "name": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "id",
                                  "name"
                                ],
                                "additionalProperties": false
                              },
                              "createdAt": {
                                "type": "string",
                                "minLength": 20
                              },
                              "applications": {
                                "$ref": "#/components/schemas/Applications"
                              },
                              "direction": {
                                "type": "string",
                                "enum": [
                                  "IN",
                                  "OUT"
                                ]
                              },
                              "refundedMinor": {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              "voided": {
                                "$ref": "#/components/schemas/Voided2"
                              },
                              "deposit": {
                                "$ref": "#/components/schemas/Deposit"
                              },
                              "refund": {
                                "anyOf": [
                                  {
                                    "type": "object",
                                    "properties": {
                                      "creditMemoId": {
                                        "type": "string"
                                      },
                                      "number": {
                                        "type": "string"
                                      },
                                      "amountMinor": {
                                        "type": "string",
                                        "pattern": "^-?\\d+$"
                                      }
                                    },
                                    "required": [
                                      "creditMemoId",
                                      "number",
                                      "amountMinor"
                                    ],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "depositRefund": {
                                "anyOf": [
                                  {
                                    "type": "object",
                                    "properties": {
                                      "depositReceiptId": {
                                        "type": "string"
                                      },
                                      "receivedOn": {
                                        "type": "string",
                                        "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                                      },
                                      "amountMinor": {
                                        "type": "string",
                                        "pattern": "^-?\\d+$"
                                      }
                                    },
                                    "required": [
                                      "depositReceiptId",
                                      "receivedOn",
                                      "amountMinor"
                                    ],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              }
                            },
                            "required": [
                              "id",
                              "entityId",
                              "entityName",
                              "customer",
                              "receivedOn",
                              "amountMinor",
                              "appliedMinor",
                              "unappliedMinor",
                              "currency",
                              "method",
                              "reference",
                              "bankAccount",
                              "sourceTransactionId",
                              "entryId",
                              "entryNumber",
                              "entryStatus",
                              "recordedBy",
                              "createdAt",
                              "applications",
                              "direction",
                              "refundedMinor",
                              "voided",
                              "deposit",
                              "refund",
                              "depositRefund"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "nextCursor": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "total": {
                          "anyOf": [
                            {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      },
                      "required": [
                        "data",
                        "nextCursor",
                        "total"
                      ],
                      "additionalProperties": false
                    },
                    "creditNotes": {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "number": {
                                "type": "string"
                              },
                              "entityId": {
                                "type": "string"
                              },
                              "entityName": {
                                "type": "string"
                              },
                              "issueDate": {
                                "type": "string",
                                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                              },
                              "currency": {
                                "type": "string",
                                "pattern": "^[A-Z]{3}$"
                              },
                              "totalMinor": {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              "appliedMinor": {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              "refundedMinor": {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              "unappliedMinor": {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              "status": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "id",
                              "number",
                              "entityId",
                              "entityName",
                              "issueDate",
                              "currency",
                              "totalMinor",
                              "appliedMinor",
                              "refundedMinor",
                              "unappliedMinor",
                              "status"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "nextCursor": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "total": {
                          "anyOf": [
                            {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      },
                      "required": [
                        "data",
                        "nextCursor",
                        "total"
                      ],
                      "additionalProperties": false
                    },
                    "exchangeDifferences": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "entityId": {
                            "type": "string"
                          },
                          "entityName": {
                            "type": "string"
                          },
                          "currency": {
                            "type": "string",
                            "pattern": "^[A-Z]{3}$"
                          },
                          "unclearedMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          }
                        },
                        "required": [
                          "entityId",
                          "entityName",
                          "currency",
                          "unclearedMinor"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "usualCompanySuggestion": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "entity": {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": "string"
                                },
                                "name": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "id",
                                "name"
                              ],
                              "additionalProperties": false
                            },
                            "invoiceCount": {
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 9007199254740991
                            }
                          },
                          "required": [
                            "entity",
                            "invoiceCount"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "departmentSuggestion": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "value": {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": "string"
                                },
                                "name": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "id",
                                "name"
                              ],
                              "additionalProperties": false
                            },
                            "invoiceCount": {
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 9007199254740991
                            }
                          },
                          "required": [
                            "value",
                            "invoiceCount"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "customer",
                    "openInvoices",
                    "recentReceipts",
                    "creditNotes",
                    "exchangeDifferences"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "404": {
            "$ref": "#/components/responses/Problem404"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      },
      "patch": {
        "operationId": "updateCustomer",
        "summary": "Changes a customer's details.",
        "description": "Changes a customer's details. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "customerId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "displayName": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "legalName": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 200
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "country": {
                    "type": "string",
                    "pattern": "^[A-Z]{2}$"
                  },
                  "region": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^(CA|US)-[A-Z]{2}$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "email": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 200
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "phone": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 50
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "address": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 500
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "notes": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 2000
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "website": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 300,
                        "pattern": "^https?:\\/\\/\\S+$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "language": {
                    "type": "string",
                    "enum": [
                      "en",
                      "fr"
                    ]
                  },
                  "gstHstNumber": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 32,
                        "pattern": "^[0-9]{9}RT[0-9]{4}$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "qstNumber": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 32,
                        "pattern": "^[0-9]{10}TQ[0-9]{4}$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "pstNumber": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 32,
                        "pattern": "^PST-[0-9]{4}-[0-9]{4}$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "billingAddress": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 500
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "paymentTermsId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "contacts": {
                    "$ref": "#/components/schemas/Contacts"
                  },
                  "parentCustomerId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 64
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "invoicesToParent": {
                    "type": "boolean"
                  },
                  "relatedParty": {
                    "type": "boolean"
                  },
                  "relatedPartyNote": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 500
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "businessNumber": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 32,
                        "pattern": "^[0-9]{9}$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "corporation": {
                    "anyOf": [
                      {
                        "$ref": "#/components/schemas/Corporation"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "defaultCurrency": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^[A-Z]{3}$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "defaultEntityId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 64
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "defaultDepartmentValueId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 64
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "creditInsurance": {
                    "anyOf": [
                      {
                        "$ref": "#/components/schemas/CreditInsurance"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "customFields": {
                    "$ref": "#/components/schemas/CustomFields6"
                  },
                  "taxStatus": {
                    "type": "string",
                    "enum": [
                      "STANDARD",
                      "INDIAN_ACT_S87_RELIEF"
                    ]
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "Ledger-Position": {
                "$ref": "#/components/headers/LedgerPosition"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ArchiveCustomerResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem400"
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "404": {
            "$ref": "#/components/responses/Problem404"
          },
          "409": {
            "$ref": "#/components/responses/Problem409"
          },
          "412": {
            "$ref": "#/components/responses/Problem412"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/customers/{customerId}/addresses": {
      "get": {
        "operationId": "listCustomerAddresses",
        "summary": "Lists the addresses of a customer.",
        "description": "Lists the addresses of a customer. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "customerId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "kind",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "BILLING",
                "SHIP_TO"
              ]
            }
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 512
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Addresses"
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "total": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "data",
                    "nextCursor",
                    "total"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "404": {
            "$ref": "#/components/responses/Problem404"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      },
      "post": {
        "operationId": "createCustomerAddress",
        "summary": "Adds an address to a customer.",
        "description": "Adds an address to a customer. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "customerId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AddressesItem2"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "Ledger-Position": {
                "$ref": "#/components/headers/LedgerPosition"
              },
              "Location": {
                "$ref": "#/components/headers/Location"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AddressesItem"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem400"
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "404": {
            "$ref": "#/components/responses/Problem404"
          },
          "409": {
            "$ref": "#/components/responses/Problem409"
          },
          "412": {
            "$ref": "#/components/responses/Problem412"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/customers/{customerId}/addresses/{addressId}": {
      "patch": {
        "operationId": "updateCustomerAddress",
        "summary": "Changes an address of a customer.",
        "description": "Changes an address of a customer. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "customerId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "addressId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "line1": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "line2": {
                    "type": "string",
                    "maxLength": 200
                  },
                  "city": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 120
                  },
                  "region": {
                    "type": "string",
                    "maxLength": 5
                  },
                  "postalCode": {
                    "type": "string",
                    "maxLength": 20
                  },
                  "country": {
                    "default": "CA",
                    "type": "string",
                    "pattern": "^[A-Z]{2}$"
                  },
                  "placeId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 300
                  },
                  "label": {
                    "type": "string",
                    "maxLength": 80
                  },
                  "onReserve": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "line1",
                  "city"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "Ledger-Position": {
                "$ref": "#/components/headers/LedgerPosition"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AddressesItem"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem400"
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "404": {
            "$ref": "#/components/responses/Problem404"
          },
          "409": {
            "$ref": "#/components/responses/Problem409"
          },
          "412": {
            "$ref": "#/components/responses/Problem412"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/customers/{customerId}/addresses/{addressId}/default": {
      "post": {
        "operationId": "setDefaultCustomerAddress",
        "summary": "Makes one address the default for a customer.",
        "description": "Makes one address the default for a customer. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "customerId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "addressId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "Ledger-Position": {
                "$ref": "#/components/headers/LedgerPosition"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AddressesItem"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem400"
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "404": {
            "$ref": "#/components/responses/Problem404"
          },
          "409": {
            "$ref": "#/components/responses/Problem409"
          },
          "412": {
            "$ref": "#/components/responses/Problem412"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/customers/{customerId}/addresses/{addressId}/remove": {
      "post": {
        "operationId": "removeCustomerAddress",
        "summary": "Removes an address from a customer.",
        "description": "Removes an address from a customer. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "customerId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "addressId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "Ledger-Position": {
                "$ref": "#/components/headers/LedgerPosition"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AddressesItem"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem400"
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "404": {
            "$ref": "#/components/responses/Problem404"
          },
          "409": {
            "$ref": "#/components/responses/Problem409"
          },
          "412": {
            "$ref": "#/components/responses/Problem412"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/customers/{customerId}/archive": {
      "post": {
        "operationId": "archiveCustomer",
        "summary": "Archives a customer so no new invoices can be raised against it.",
        "description": "Archives a customer so no new invoices can be raised against it. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:approve",
        "parameters": [
          {
            "name": "customerId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "reason": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 500
                  }
                },
                "required": [
                  "reason"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "Ledger-Position": {
                "$ref": "#/components/headers/LedgerPosition"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ArchiveCustomerResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem400"
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "404": {
            "$ref": "#/components/responses/Problem404"
          },
          "409": {
            "$ref": "#/components/responses/Problem409"
          },
          "412": {
            "$ref": "#/components/responses/Problem412"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/customers/{customerId}/collection-activities": {
      "get": {
        "operationId": "listCollectionActivities",
        "summary": "Lists the collection activities recorded for a customer.",
        "description": "Lists the collection activities recorded for a customer. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "customerId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "invoiceId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "kind",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "CALL",
                "EMAIL",
                "MEETING",
                "LETTER",
                "NOTE"
              ]
            }
          },
          {
            "name": "outcome",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "NO_ANSWER",
                "LEFT_MESSAGE",
                "PROMISED_TO_PAY",
                "PAYMENT_SENT",
                "DISPUTED",
                "WILL_CALL_BACK",
                "OTHER"
              ]
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 512
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ListCollectionActivitiesResponseItem"
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "total": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "data",
                    "nextCursor",
                    "total"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "404": {
            "$ref": "#/components/responses/Problem404"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      },
      "post": {
        "operationId": "createCollectionActivity",
        "summary": "Records a collection activity for a customer.",
        "description": "Records a collection activity for a customer. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "customerId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "invoiceId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "kind": {
                    "type": "string",
                    "enum": [
                      "CALL",
                      "EMAIL",
                      "MEETING",
                      "LETTER",
                      "NOTE"
                    ]
                  },
                  "occurredAt": {
                    "type": "string",
                    "minLength": 20
                  },
                  "contactName": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "summary": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 2000
                  },
                  "outcome": {
                    "type": "string",
                    "enum": [
                      "NO_ANSWER",
                      "LEFT_MESSAGE",
                      "PROMISED_TO_PAY",
                      "PAYMENT_SENT",
                      "DISPUTED",
                      "WILL_CALL_BACK",
                      "OTHER"
                    ]
                  },
                  "promisedOn": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  },
                  "promisedAmountMinor": {
                    "type": "string",
                    "pattern": "^-?\\d+$"
                  },
                  "promisedCurrency": {
                    "type": "string",
                    "pattern": "^[A-Z]{3}$"
                  },
                  "correctsId": {
                    "type": "string",
                    "minLength": 1
                  }
                },
                "required": [
                  "kind",
                  "occurredAt",
                  "summary",
                  "outcome"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "Ledger-Position": {
                "$ref": "#/components/headers/LedgerPosition"
              },
              "Location": {
                "$ref": "#/components/headers/Location"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListCollectionActivitiesResponseItem"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem400"
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "404": {
            "$ref": "#/components/responses/Problem404"
          },
          "409": {
            "$ref": "#/components/responses/Problem409"
          },
          "412": {
            "$ref": "#/components/responses/Problem412"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/customers/{customerId}/collections-timeline": {
      "get": {
        "operationId": "listCollectionsTimeline",
        "summary": "Returns the collections timeline for a customer.",
        "description": "Returns the collections timeline for a customer. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "customerId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 512
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "oneOf": [
                          {
                            "type": "object",
                            "properties": {
                              "entryKind": {
                                "type": "string",
                                "const": "ACTIVITY"
                              },
                              "key": {
                                "type": "string"
                              },
                              "at": {
                                "type": "string",
                                "minLength": 20
                              },
                              "activity": {
                                "$ref": "#/components/schemas/ListCollectionActivitiesResponseItem"
                              }
                            },
                            "required": [
                              "entryKind",
                              "key",
                              "at",
                              "activity"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "entryKind": {
                                "type": "string",
                                "const": "REMINDER"
                              },
                              "key": {
                                "type": "string"
                              },
                              "at": {
                                "type": "string",
                                "minLength": 20
                              },
                              "reminder": {
                                "type": "object",
                                "properties": {
                                  "deliveryId": {
                                    "type": "string"
                                  },
                                  "invoice": {
                                    "anyOf": [
                                      {
                                        "type": "object",
                                        "properties": {
                                          "id": {
                                            "type": "string"
                                          },
                                          "number": {
                                            "type": [
                                              "string",
                                              "null"
                                            ]
                                          }
                                        },
                                        "required": [
                                          "id",
                                          "number"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ]
                                  },
                                  "recipient": {
                                    "type": "string"
                                  },
                                  "status": {
                                    "type": "string",
                                    "enum": [
                                      "QUEUED",
                                      "SENT",
                                      "BOUNCED",
                                      "FAILED"
                                    ]
                                  },
                                  "stepPosition": {
                                    "anyOf": [
                                      {
                                        "type": "integer",
                                        "minimum": -9007199254740991,
                                        "maximum": 9007199254740991
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ]
                                  },
                                  "sentBy": {
                                    "type": "object",
                                    "properties": {
                                      "id": {
                                        "type": "string"
                                      },
                                      "name": {
                                        "type": "string"
                                      }
                                    },
                                    "required": [
                                      "id",
                                      "name"
                                    ],
                                    "additionalProperties": false
                                  }
                                },
                                "required": [
                                  "deliveryId",
                                  "invoice",
                                  "recipient",
                                  "status",
                                  "stepPosition",
                                  "sentBy"
                                ],
                                "additionalProperties": false
                              }
                            },
                            "required": [
                              "entryKind",
                              "key",
                              "at",
                              "reminder"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "entryKind": {
                                "type": "string",
                                "const": "PAUSE"
                              },
                              "key": {
                                "type": "string"
                              },
                              "at": {
                                "type": "string",
                                "minLength": 20
                              },
                              "pause": {
                                "type": "object",
                                "properties": {
                                  "pauseId": {
                                    "type": "string"
                                  },
                                  "event": {
                                    "type": "string",
                                    "enum": [
                                      "PAUSED",
                                      "LIFTED"
                                    ]
                                  },
                                  "invoice": {
                                    "anyOf": [
                                      {
                                        "type": "object",
                                        "properties": {
                                          "id": {
                                            "type": "string"
                                          },
                                          "number": {
                                            "type": [
                                              "string",
                                              "null"
                                            ]
                                          }
                                        },
                                        "required": [
                                          "id",
                                          "number"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ]
                                  },
                                  "reason": {
                                    "type": "string"
                                  },
                                  "by": {
                                    "anyOf": [
                                      {
                                        "type": "object",
                                        "properties": {
                                          "id": {
                                            "type": "string"
                                          },
                                          "name": {
                                            "type": "string"
                                          }
                                        },
                                        "required": [
                                          "id",
                                          "name"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ]
                                  },
                                  "byDispute": {
                                    "type": "boolean"
                                  }
                                },
                                "required": [
                                  "pauseId",
                                  "event",
                                  "invoice",
                                  "reason",
                                  "by",
                                  "byDispute"
                                ],
                                "additionalProperties": false
                              }
                            },
                            "required": [
                              "entryKind",
                              "key",
                              "at",
                              "pause"
                            ],
                            "additionalProperties": false
                          }
                        ]
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "total": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "data",
                    "nextCursor",
                    "total"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "404": {
            "$ref": "#/components/responses/Problem404"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/customers/{customerId}/company-profile": {
      "get": {
        "operationId": "getCustomerCompanyProfile",
        "summary": "Returns the company profile of a customer.",
        "description": "Returns the company profile of a customer. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "customerId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "profile": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "customerId": {
                              "type": "string"
                            },
                            "source": {
                              "type": "string",
                              "enum": [
                                "APOLLO"
                              ]
                            },
                            "matchedOn": {
                              "type": "string",
                              "enum": [
                                "DOMAIN",
                                "NAME"
                              ]
                            },
                            "matchValue": {
                              "type": "string"
                            },
                            "apolloOrganizationId": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "organization": {
                              "type": "object",
                              "properties": {
                                "name": {
                                  "type": [
                                    "string",
                                    "null"
                                  ]
                                },
                                "primaryDomain": {
                                  "type": [
                                    "string",
                                    "null"
                                  ]
                                },
                                "websiteUrl": {
                                  "type": [
                                    "string",
                                    "null"
                                  ]
                                },
                                "industry": {
                                  "type": [
                                    "string",
                                    "null"
                                  ]
                                },
                                "industries": {
                                  "type": "array",
                                  "items": {
                                    "type": "string"
                                  }
                                },
                                "naicsCodes": {
                                  "type": "array",
                                  "items": {
                                    "type": "string"
                                  }
                                },
                                "sicCodes": {
                                  "type": "array",
                                  "items": {
                                    "type": "string"
                                  }
                                },
                                "estimatedNumEmployees": {
                                  "anyOf": [
                                    {
                                      "type": "integer",
                                      "minimum": 0,
                                      "maximum": 9007199254740991
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "annualRevenuePrinted": {
                                  "type": [
                                    "string",
                                    "null"
                                  ]
                                },
                                "foundedYear": {
                                  "anyOf": [
                                    {
                                      "type": "integer",
                                      "minimum": -9007199254740991,
                                      "maximum": 9007199254740991
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "city": {
                                  "type": [
                                    "string",
                                    "null"
                                  ]
                                },
                                "state": {
                                  "type": [
                                    "string",
                                    "null"
                                  ]
                                },
                                "country": {
                                  "type": [
                                    "string",
                                    "null"
                                  ]
                                },
                                "rawAddress": {
                                  "type": [
                                    "string",
                                    "null"
                                  ]
                                },
                                "linkedinUrl": {
                                  "type": [
                                    "string",
                                    "null"
                                  ]
                                },
                                "shortDescription": {
                                  "type": [
                                    "string",
                                    "null"
                                  ]
                                },
                                "logoUrl": {
                                  "type": [
                                    "string",
                                    "null"
                                  ]
                                }
                              },
                              "required": [
                                "name",
                                "primaryDomain",
                                "websiteUrl",
                                "industry",
                                "industries",
                                "naicsCodes",
                                "sicCodes",
                                "estimatedNumEmployees",
                                "annualRevenuePrinted",
                                "foundedYear",
                                "city",
                                "state",
                                "country",
                                "rawAddress",
                                "linkedinUrl",
                                "shortDescription",
                                "logoUrl"
                              ],
                              "additionalProperties": false
                            },
                            "people": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "apolloPersonId": {
                                    "type": "string"
                                  },
                                  "firstName": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  },
                                  "lastNameObfuscated": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  },
                                  "title": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  },
                                  "hasEmail": {
                                    "type": "boolean"
                                  }
                                },
                                "required": [
                                  "apolloPersonId",
                                  "firstName",
                                  "lastNameObfuscated",
                                  "title",
                                  "hasEmail"
                                ],
                                "additionalProperties": false
                              }
                            },
                            "peopleTotal": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "fetchedAt": {
                              "type": "string",
                              "minLength": 20
                            },
                            "fetchedBy": {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": "string"
                                },
                                "name": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "id",
                                "name"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "required": [
                            "customerId",
                            "source",
                            "matchedOn",
                            "matchValue",
                            "apolloOrganizationId",
                            "organization",
                            "people",
                            "peopleTotal",
                            "fetchedAt",
                            "fetchedBy"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "profile"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "404": {
            "$ref": "#/components/responses/Problem404"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/customers/{customerId}/company-profile/refresh-requests": {
      "post": {
        "operationId": "requestCompanyProfileRefresh",
        "summary": "Asks for a customer's company profile to be looked up again and answers at once; read it with getCustomerCompanyProfile once fetchedAt passes requestedAt.",
        "description": "Asks for a customer's company profile to be looked up again and answers at once; read it with getCustomerCompanyProfile once fetchedAt passes requestedAt. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "customerId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "matchOn": {
                    "type": "string",
                    "enum": [
                      "DOMAIN",
                      "NAME"
                    ]
                  },
                  "value": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Accepted: the work is done after the answer, or waits for a person's confirmation.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "Ledger-Position": {
                "$ref": "#/components/headers/LedgerPosition"
              },
              "Location": {
                "$ref": "#/components/headers/Location"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "customerId": {
                      "type": "string"
                    },
                    "queued": {
                      "type": "boolean",
                      "const": true
                    },
                    "matchedOn": {
                      "type": "string",
                      "enum": [
                        "DOMAIN",
                        "NAME"
                      ]
                    },
                    "requestedAt": {
                      "type": "string",
                      "minLength": 20
                    }
                  },
                  "required": [
                    "customerId",
                    "queued",
                    "matchedOn",
                    "requestedAt"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem400"
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "404": {
            "$ref": "#/components/responses/Problem404"
          },
          "409": {
            "$ref": "#/components/responses/Problem409"
          },
          "412": {
            "$ref": "#/components/responses/Problem412"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/customers/{customerId}/credit-limit": {
      "post": {
        "operationId": "setCustomerCreditLimit",
        "summary": "Sets the credit limit of a customer.",
        "description": "Sets the credit limit of a customer. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:approve",
        "parameters": [
          {
            "name": "customerId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "creditLimitMinor": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^-?\\d+$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "creditLimitMinor"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "Ledger-Position": {
                "$ref": "#/components/headers/LedgerPosition"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ArchiveCustomerResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem400"
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "404": {
            "$ref": "#/components/responses/Problem404"
          },
          "409": {
            "$ref": "#/components/responses/Problem409"
          },
          "412": {
            "$ref": "#/components/responses/Problem412"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/customers/{customerId}/credit-rating/history": {
      "get": {
        "operationId": "listCustomerCreditRatingHistory",
        "summary": "Lists the credit rating changes for a customer.",
        "description": "Lists the credit rating changes for a customer. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "customerId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 512
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "asOf": {
                            "type": "string",
                            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                          },
                          "score": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 100
                          },
                          "band": {
                            "type": "string",
                            "enum": [
                              "A",
                              "B",
                              "C",
                              "D",
                              "E",
                              "N"
                            ]
                          },
                          "headline": {
                            "type": "string"
                          },
                          "policyVersion": {
                            "type": "string"
                          },
                          "capped": {
                            "anyOf": [
                              {
                                "type": "string",
                                "enum": [
                                  "WRITE_OFF",
                                  "OVER_90"
                                ]
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "thinFile": {
                            "type": "boolean"
                          }
                        },
                        "required": [
                          "id",
                          "asOf",
                          "score",
                          "band",
                          "headline",
                          "policyVersion",
                          "capped",
                          "thinFile"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "total": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "data",
                    "nextCursor",
                    "total"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "404": {
            "$ref": "#/components/responses/Problem404"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/customers/{customerId}/credit-rating/override": {
      "post": {
        "operationId": "overrideCustomerCreditRating",
        "summary": "Overrides a customer's credit rating with a reason.",
        "description": "Overrides a customer's credit rating with a reason. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:approve",
        "parameters": [
          {
            "name": "customerId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "band": {
                    "type": "string",
                    "enum": [
                      "A",
                      "B",
                      "C",
                      "D",
                      "E"
                    ]
                  },
                  "reason": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 500
                  },
                  "expiresOn": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  }
                },
                "required": [
                  "band",
                  "reason"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "Ledger-Position": {
                "$ref": "#/components/headers/LedgerPosition"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ArchiveCustomerResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem400"
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "404": {
            "$ref": "#/components/responses/Problem404"
          },
          "409": {
            "$ref": "#/components/responses/Problem409"
          },
          "412": {
            "$ref": "#/components/responses/Problem412"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/customers/{customerId}/credit-rating/override/lift": {
      "post": {
        "operationId": "liftCustomerCreditRatingOverride",
        "summary": "Lifts a credit rating override on a customer.",
        "description": "Lifts a credit rating override on a customer. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:approve",
        "parameters": [
          {
            "name": "customerId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "reason": {
                    "type": "string",
                    "maxLength": 500
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "Ledger-Position": {
                "$ref": "#/components/headers/LedgerPosition"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ArchiveCustomerResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem400"
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "404": {
            "$ref": "#/components/responses/Problem404"
          },
          "409": {
            "$ref": "#/components/responses/Problem409"
          },
          "412": {
            "$ref": "#/components/responses/Problem412"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/customers/{customerId}/exemption-certificates": {
      "get": {
        "operationId": "listExemptionCertificates",
        "summary": "Lists the tax exemption certificates a customer holds.",
        "description": "Lists the tax exemption certificates a customer holds. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "customerId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "includeRemoved",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "true",
                "false"
              ]
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 512
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ListExemptionCertificatesResponseItem"
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "total": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "data",
                    "nextCursor",
                    "total"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "404": {
            "$ref": "#/components/responses/Problem404"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      },
      "post": {
        "operationId": "recordExemptionCertificate",
        "summary": "Records a tax exemption certificate a customer provided.",
        "description": "Records a tax exemption certificate a customer provided. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "customerId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "documentId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "scope": {
                    "type": "string",
                    "enum": [
                      "PROVINCIAL_SALES_TAX",
                      "GST_HST_RELIEF",
                      "NON_RESIDENT_STATUS",
                      "EXPORT_PROOF",
                      "INDIAN_ACT_S87"
                    ]
                  },
                  "jurisdiction": {
                    "type": "string",
                    "pattern": "^[A-Z]{2}(-[A-Z]{2,3})?$"
                  },
                  "holderKind": {
                    "type": "string",
                    "enum": [
                      "INDIVIDUAL",
                      "BAND",
                      "BAND_EMPOWERED_ENTITY",
                      "INCORPORATED_BAND_EMPOWERED_ENTITY"
                    ]
                  },
                  "purpose": {
                    "type": "string",
                    "enum": [
                      "BAND_MANAGEMENT",
                      "REAL_PROPERTY_ON_RESERVE"
                    ]
                  },
                  "bandName": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "bandNumber": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 20
                  },
                  "certificateNumber": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100
                  },
                  "registryNumber": {
                    "type": "string",
                    "pattern": "^\\d{10}$"
                  },
                  "effectiveFrom": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  },
                  "expiresOn": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  },
                  "memo": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 500
                  }
                },
                "required": [
                  "documentId",
                  "scope",
                  "jurisdiction",
                  "effectiveFrom"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "Ledger-Position": {
                "$ref": "#/components/headers/LedgerPosition"
              },
              "Location": {
                "$ref": "#/components/headers/Location"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListExemptionCertificatesResponseItem"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem400"
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "404": {
            "$ref": "#/components/responses/Problem404"
          },
          "409": {
            "$ref": "#/components/responses/Problem409"
          },
          "412": {
            "$ref": "#/components/responses/Problem412"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/customers/{customerId}/exemption-certificates/{certificateId}/memo": {
      "put": {
        "operationId": "updateExemptionCertificateMemo",
        "summary": "Changes the note on a tax exemption certificate.",
        "description": "Changes the note on a tax exemption certificate. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "customerId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "certificateId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "memo": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 500
                  }
                },
                "required": [
                  "memo"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "Ledger-Position": {
                "$ref": "#/components/headers/LedgerPosition"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListExemptionCertificatesResponseItem"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem400"
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "404": {
            "$ref": "#/components/responses/Problem404"
          },
          "409": {
            "$ref": "#/components/responses/Problem409"
          },
          "412": {
            "$ref": "#/components/responses/Problem412"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/customers/{customerId}/exemption-certificates/{certificateId}/remove": {
      "post": {
        "operationId": "removeExemptionCertificate",
        "summary": "Removes a tax exemption certificate from a customer.",
        "description": "Removes a tax exemption certificate from a customer. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "customerId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "certificateId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "reason": {
                    "type": "string",
                    "minLength": 3,
                    "maxLength": 500
                  }
                },
                "required": [
                  "reason"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "Ledger-Position": {
                "$ref": "#/components/headers/LedgerPosition"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListExemptionCertificatesResponseItem"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem400"
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "404": {
            "$ref": "#/components/responses/Problem404"
          },
          "409": {
            "$ref": "#/components/responses/Problem409"
          },
          "412": {
            "$ref": "#/components/responses/Problem412"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/customers/{customerId}/hold": {
      "post": {
        "operationId": "holdCustomer",
        "summary": "Puts a customer on hold so no new invoices are raised.",
        "description": "Puts a customer on hold so no new invoices are raised. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:approve",
        "parameters": [
          {
            "name": "customerId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "reason": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 500
                  }
                },
                "required": [
                  "reason"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "Ledger-Position": {
                "$ref": "#/components/headers/LedgerPosition"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ArchiveCustomerResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem400"
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "404": {
            "$ref": "#/components/responses/Problem404"
          },
          "409": {
            "$ref": "#/components/responses/Problem409"
          },
          "412": {
            "$ref": "#/components/responses/Problem412"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/customers/{customerId}/hold/lift": {
      "post": {
        "operationId": "liftCustomerHold",
        "summary": "Lifts the hold on a customer.",
        "description": "Lifts the hold on a customer. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:approve",
        "parameters": [
          {
            "name": "customerId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {},
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "Ledger-Position": {
                "$ref": "#/components/headers/LedgerPosition"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ArchiveCustomerResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem400"
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "404": {
            "$ref": "#/components/responses/Problem404"
          },
          "409": {
            "$ref": "#/components/responses/Problem409"
          },
          "412": {
            "$ref": "#/components/responses/Problem412"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/customers/{customerId}/links": {
      "post": {
        "operationId": "linkCustomer",
        "summary": "Links a customer to its record in an outside system.",
        "description": "Links a customer to its record in an outside system. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "customerId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ExternalRef"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "Ledger-Position": {
                "$ref": "#/components/headers/LedgerPosition"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ArchiveCustomerResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem400"
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "404": {
            "$ref": "#/components/responses/Problem404"
          },
          "409": {
            "$ref": "#/components/responses/Problem409"
          },
          "412": {
            "$ref": "#/components/responses/Problem412"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/customers/{customerId}/links/{linkId}/unlink": {
      "post": {
        "operationId": "unlinkCustomer",
        "summary": "Removes a customer's link to its record in an outside system.",
        "description": "Removes a customer's link to its record in an outside system. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "customerId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "linkId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "Ledger-Position": {
                "$ref": "#/components/headers/LedgerPosition"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ArchiveCustomerResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem400"
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "404": {
            "$ref": "#/components/responses/Problem404"
          },
          "409": {
            "$ref": "#/components/responses/Problem409"
          },
          "412": {
            "$ref": "#/components/responses/Problem412"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/customers/{customerId}/pad-mandates": {
      "get": {
        "operationId": "listPadMandates",
        "summary": "Lists the pre-authorised debit mandates a customer has given.",
        "description": "Lists the pre-authorised debit mandates a customer has given. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "customerId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "PENDING",
                "ACTIVE",
                "INACTIVE",
                "REVOKED"
              ]
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 512
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "customerId": {
                            "type": "string"
                          },
                          "source": {
                            "type": "string",
                            "enum": [
                              "STRIPE",
                              "AGREEMENT"
                            ]
                          },
                          "stripeMandateId": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "agreementDocumentId": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "transactionType": {
                            "type": "string",
                            "enum": [
                              "BUSINESS",
                              "PERSONAL"
                            ]
                          },
                          "acceptedAt": {
                            "type": "string",
                            "minLength": 20
                          },
                          "bankName": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "bankLastFour": {
                            "type": "string"
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "PENDING",
                              "ACTIVE",
                              "INACTIVE",
                              "REVOKED"
                            ]
                          },
                          "createdBy": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "name": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "id",
                                  "name"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "createdAt": {
                            "type": "string",
                            "minLength": 20
                          },
                          "revokedAt": {
                            "anyOf": [
                              {
                                "type": "string",
                                "minLength": 20
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "revokedBy": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "name": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "id",
                                  "name"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "revokeReason": {
                            "type": [
                              "string",
                              "null"
                            ]
                          }
                        },
                        "required": [
                          "id",
                          "customerId",
                          "source",
                          "stripeMandateId",
                          "agreementDocumentId",
                          "transactionType",
                          "acceptedAt",
                          "bankName",
                          "bankLastFour",
                          "status",
                          "createdBy",
                          "createdAt",
                          "revokedAt",
                          "revokedBy",
                          "revokeReason"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "total": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "data",
                    "nextCursor",
                    "total"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "404": {
            "$ref": "#/components/responses/Problem404"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/customers/{customerId}/portal-link": {
      "post": {
        "operationId": "issuePortalLink",
        "summary": "Issues a portal link a customer can use to see their invoices.",
        "description": "Issues a portal link a customer can use to see their invoices. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "customerId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "reissue": {
                    "type": "boolean"
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "Ledger-Position": {
                "$ref": "#/components/headers/LedgerPosition"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "customerId": {
                      "type": "string"
                    },
                    "issuedAt": {
                      "type": "string",
                      "minLength": 20
                    },
                    "issuedBy": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string"
                            },
                            "name": {
                              "type": [
                                "string",
                                "null"
                              ]
                            }
                          },
                          "required": [
                            "id",
                            "name"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "lastOpenedAt": {
                      "anyOf": [
                        {
                          "type": "string",
                          "minLength": 20
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "opens": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "portalEnabled": {
                      "type": "boolean"
                    },
                    "url": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "customerId",
                    "issuedAt",
                    "issuedBy",
                    "lastOpenedAt",
                    "opens",
                    "portalEnabled",
                    "url"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem400"
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "404": {
            "$ref": "#/components/responses/Problem404"
          },
          "409": {
            "$ref": "#/components/responses/Problem409"
          },
          "412": {
            "$ref": "#/components/responses/Problem412"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/customers/{customerId}/portal-link/revoke": {
      "post": {
        "operationId": "revokePortalLink",
        "summary": "Revokes a customer portal link.",
        "description": "Revokes a customer portal link. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "customerId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "reason": {
                    "type": "string",
                    "minLength": 3,
                    "maxLength": 500
                  }
                },
                "required": [
                  "reason"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "Ledger-Position": {
                "$ref": "#/components/headers/LedgerPosition"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "customerId": {
                      "type": "string"
                    },
                    "revokedAt": {
                      "type": "string",
                      "minLength": 20
                    }
                  },
                  "required": [
                    "customerId",
                    "revokedAt"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem400"
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "404": {
            "$ref": "#/components/responses/Problem404"
          },
          "409": {
            "$ref": "#/components/responses/Problem409"
          },
          "412": {
            "$ref": "#/components/responses/Problem412"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/customers/{customerId}/prices": {
      "get": {
        "operationId": "listCustomerPrices",
        "summary": "Lists the prices agreed with a customer.",
        "description": "Lists the prices agreed with a customer. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "customerId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "productId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "currency",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^[A-Z]{3}$"
            }
          },
          {
            "name": "activeOn",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
            }
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 100
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 512
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ListCustomerPricesResponseItem"
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "total": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "data",
                    "nextCursor",
                    "total"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "404": {
            "$ref": "#/components/responses/Problem404"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      },
      "post": {
        "operationId": "createCustomerPrice",
        "summary": "Adds a price agreed with a customer.",
        "description": "Adds a price agreed with a customer. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "customerId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "productId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "priceMinor": {
                    "type": "string",
                    "pattern": "^-?\\d+$"
                  },
                  "currency": {
                    "type": "string",
                    "pattern": "^[A-Z]{3}$"
                  },
                  "validFrom": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  },
                  "validTo": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  }
                },
                "required": [
                  "productId",
                  "priceMinor",
                  "currency",
                  "validFrom"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "Ledger-Position": {
                "$ref": "#/components/headers/LedgerPosition"
              },
              "Location": {
                "$ref": "#/components/headers/Location"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListCustomerPricesResponseItem"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem400"
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "404": {
            "$ref": "#/components/responses/Problem404"
          },
          "409": {
            "$ref": "#/components/responses/Problem409"
          },
          "412": {
            "$ref": "#/components/responses/Problem412"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/customers/{customerId}/prices/{priceId}": {
      "patch": {
        "operationId": "updateCustomerPrice",
        "summary": "Changes a price agreed with a customer.",
        "description": "Changes a price agreed with a customer. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "customerId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "priceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "priceMinor": {
                    "type": "string",
                    "pattern": "^-?\\d+$"
                  },
                  "validFrom": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  },
                  "validTo": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "Ledger-Position": {
                "$ref": "#/components/headers/LedgerPosition"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListCustomerPricesResponseItem"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem400"
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "404": {
            "$ref": "#/components/responses/Problem404"
          },
          "409": {
            "$ref": "#/components/responses/Problem409"
          },
          "412": {
            "$ref": "#/components/responses/Problem412"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/customers/{customerId}/prices/{priceId}/remove": {
      "post": {
        "operationId": "removeCustomerPrice",
        "summary": "Removes a price agreed with a customer.",
        "description": "Removes a price agreed with a customer. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "customerId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "priceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "Ledger-Position": {
                "$ref": "#/components/headers/LedgerPosition"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "removed": {
                      "type": "boolean",
                      "const": true
                    }
                  },
                  "required": [
                    "id",
                    "removed"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem400"
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "404": {
            "$ref": "#/components/responses/Problem404"
          },
          "409": {
            "$ref": "#/components/responses/Problem409"
          },
          "412": {
            "$ref": "#/components/responses/Problem412"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/customers/{customerId}/restore": {
      "post": {
        "operationId": "restoreCustomer",
        "summary": "Restores an archived customer so invoices can be raised against it again.",
        "description": "Restores an archived customer so invoices can be raised against it again. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:approve",
        "parameters": [
          {
            "name": "customerId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "Ledger-Position": {
                "$ref": "#/components/headers/LedgerPosition"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ArchiveCustomerResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem400"
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "404": {
            "$ref": "#/components/responses/Problem404"
          },
          "409": {
            "$ref": "#/components/responses/Problem409"
          },
          "412": {
            "$ref": "#/components/responses/Problem412"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/customers/{customerId}/statement": {
      "get": {
        "operationId": "getCustomerStatement",
        "summary": "Returns the statement of account for a customer.",
        "description": "Returns the statement of account for a customer. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "customerId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "from",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
            }
          },
          {
            "name": "entityId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "currency",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^[A-Z]{3}$"
            }
          },
          {
            "name": "withChildren",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "yes",
                "no"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "customer": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "displayName": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "id",
                        "displayName"
                      ],
                      "additionalProperties": false
                    },
                    "entityId": {
                      "type": "string"
                    },
                    "entityName": {
                      "type": "string"
                    },
                    "currency": {
                      "type": "string",
                      "pattern": "^[A-Z]{3}$"
                    },
                    "from": {
                      "type": "string",
                      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                    },
                    "to": {
                      "type": "string",
                      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                    },
                    "openingBalanceMinor": {
                      "type": "string",
                      "pattern": "^-?\\d+$"
                    },
                    "closingBalanceMinor": {
                      "type": "string",
                      "pattern": "^-?\\d+$"
                    },
                    "priorClosingBalanceMinor": {
                      "type": "string",
                      "pattern": "^-?\\d+$"
                    },
                    "rows": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "type": "string",
                            "enum": [
                              "INVOICE",
                              "INVOICE_VOID",
                              "CREDIT_MEMO",
                              "CREDIT_MEMO_VOID",
                              "RECEIPT",
                              "REFUND",
                              "DEPOSIT_APPLIED",
                              "PAID_BY_PARENT",
                              "PAID_FOR_CHILD",
                              "RECEIPT_VOID",
                              "DEPOSIT_APPLIED_VOID",
                              "PAID_BY_PARENT_VOID",
                              "PAID_FOR_CHILD_VOID",
                              "WRITE_OFF",
                              "WRITE_OFF_RECOVERY",
                              "EARLY_PAYMENT_DISCOUNT",
                              "EARLY_PAYMENT_DISCOUNT_VOID"
                            ]
                          },
                          "date": {
                            "type": "string",
                            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                          },
                          "document": {
                            "type": "string"
                          },
                          "documentId": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "chargeMinor": {
                            "anyOf": [
                              {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "creditMinor": {
                            "anyOf": [
                              {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "balanceMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "customer": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "displayName": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "id",
                              "displayName"
                            ],
                            "additionalProperties": false
                          },
                          "counterparty": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "displayName": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "id",
                                  "displayName"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          }
                        },
                        "required": [
                          "kind",
                          "date",
                          "document",
                          "documentId",
                          "chargeMinor",
                          "creditMinor",
                          "balanceMinor"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "ageing": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "asOf": {
                              "type": "string",
                              "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                            },
                            "currency": {
                              "type": "string",
                              "pattern": "^[A-Z]{3}$"
                            },
                            "current": {
                              "type": "string",
                              "pattern": "^-?\\d+$"
                            },
                            "d1to30": {
                              "type": "string",
                              "pattern": "^-?\\d+$"
                            },
                            "d31to60": {
                              "type": "string",
                              "pattern": "^-?\\d+$"
                            },
                            "d61to90": {
                              "type": "string",
                              "pattern": "^-?\\d+$"
                            },
                            "over90": {
                              "type": "string",
                              "pattern": "^-?\\d+$"
                            },
                            "total": {
                              "type": "string",
                              "pattern": "^-?\\d+$"
                            },
                            "unappliedMinor": {
                              "type": "string",
                              "pattern": "^-?\\d+$"
                            },
                            "oldestDueDate": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            }
                          },
                          "required": [
                            "asOf",
                            "currency",
                            "current",
                            "d1to30",
                            "d31to60",
                            "d61to90",
                            "over90",
                            "total",
                            "unappliedMinor",
                            "oldestDueDate"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "scopes": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "entityId": {
                            "type": "string"
                          },
                          "entityName": {
                            "type": "string"
                          },
                          "currency": {
                            "type": "string",
                            "pattern": "^[A-Z]{3}$"
                          }
                        },
                        "required": [
                          "entityId",
                          "entityName",
                          "currency"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "language": {
                      "type": "string",
                      "enum": [
                        "en",
                        "fr"
                      ]
                    },
                    "depositsOnHandMinor": {
                      "type": "string",
                      "pattern": "^-?\\d+$"
                    },
                    "children": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "displayName": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "id",
                          "displayName"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "customer",
                    "entityId",
                    "entityName",
                    "currency",
                    "from",
                    "to",
                    "openingBalanceMinor",
                    "closingBalanceMinor",
                    "priorClosingBalanceMinor",
                    "rows",
                    "ageing",
                    "scopes",
                    "language",
                    "depositsOnHandMinor"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "404": {
            "$ref": "#/components/responses/Problem404"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/customers/{customerId}/statement/send": {
      "post": {
        "operationId": "sendCustomerStatement",
        "summary": "Sends a customer's statement of account.",
        "description": "Sends a customer's statement of account. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "customerId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "from": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  },
                  "to": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  },
                  "entityId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "currency": {
                    "type": "string",
                    "pattern": "^[A-Z]{3}$"
                  }
                },
                "required": [
                  "from",
                  "to",
                  "entityId",
                  "currency"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "Ledger-Position": {
                "$ref": "#/components/headers/LedgerPosition"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SendCustomerStatementResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem400"
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "404": {
            "$ref": "#/components/responses/Problem404"
          },
          "409": {
            "$ref": "#/components/responses/Problem409"
          },
          "412": {
            "$ref": "#/components/responses/Problem412"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/customers/{customerId}/statement/send/decide": {
      "post": {
        "operationId": "decideCustomerStatementSend",
        "summary": "Approves or declines sending a customer's statement.",
        "description": "Approves or declines sending a customer's statement. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:approve",
        "parameters": [
          {
            "name": "customerId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "proposalId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "decision": {
                    "type": "string",
                    "enum": [
                      "APPROVE",
                      "DECLINE"
                    ]
                  },
                  "reason": {
                    "type": "string",
                    "maxLength": 500
                  }
                },
                "required": [
                  "proposalId",
                  "decision"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "Ledger-Position": {
                "$ref": "#/components/headers/LedgerPosition"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SendCustomerStatementResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem400"
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "404": {
            "$ref": "#/components/responses/Problem404"
          },
          "409": {
            "$ref": "#/components/responses/Problem409"
          },
          "412": {
            "$ref": "#/components/responses/Problem412"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/customers/{customerId}/statement/sending": {
      "get": {
        "operationId": "getCustomerStatementSending",
        "summary": "Returns the sending record of a customer's statements.",
        "description": "Returns the sending record of a customer's statements. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "customerId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "from",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
            }
          },
          {
            "name": "entityId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "currency",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^[A-Z]{3}$"
            }
          },
          {
            "name": "withChildren",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "yes",
                "no"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "customerId": {
                      "type": "string"
                    },
                    "deliveries": {
                      "$ref": "#/components/schemas/Deliveries"
                    },
                    "pending": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "proposalId": {
                              "type": "string"
                            },
                            "recipients": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            },
                            "from": {
                              "type": "string",
                              "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                            },
                            "to": {
                              "type": "string",
                              "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                            }
                          },
                          "required": [
                            "proposalId",
                            "recipients",
                            "from",
                            "to"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "recipients": {
                      "$ref": "#/components/schemas/Recipients2"
                    },
                    "newRecipients": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "preview": {
                      "$ref": "#/components/schemas/Preview"
                    },
                    "language": {
                      "type": "string",
                      "enum": [
                        "en",
                        "fr"
                      ]
                    },
                    "senderAddress": {
                      "type": "string"
                    },
                    "senderDisplayName": {
                      "type": "string"
                    },
                    "replyToEmail": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "transportReady": {
                      "type": "boolean"
                    },
                    "blocked": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "cap": {
                      "$ref": "#/components/schemas/Cap"
                    },
                    "breaker": {
                      "$ref": "#/components/schemas/Breaker"
                    },
                    "lastSentAt": {
                      "anyOf": [
                        {
                          "type": "string",
                          "minLength": 20
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "customerId",
                    "deliveries",
                    "pending",
                    "recipients",
                    "newRecipients",
                    "preview",
                    "language",
                    "senderAddress",
                    "senderDisplayName",
                    "replyToEmail",
                    "transportReady",
                    "blocked",
                    "cap",
                    "breaker",
                    "lastSentAt"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "404": {
            "$ref": "#/components/responses/Problem404"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/disputes": {
      "get": {
        "operationId": "listDisputes",
        "summary": "Lists the disputes raised against invoices, with the server's total.",
        "description": "Lists the disputes raised against invoices, with the server's total. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "OPEN",
                "RESOLVED"
              ]
            }
          },
          {
            "name": "invoiceId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 512
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ListDisputesResponseItem"
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "total": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "data",
                    "nextCursor",
                    "total"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/disputes/{disputeId}": {
      "get": {
        "operationId": "getDispute",
        "summary": "Returns one dispute with its messages and status.",
        "description": "Returns one dispute with its messages and status. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "disputeId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListDisputesResponseItem"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "404": {
            "$ref": "#/components/responses/Problem404"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/disputes/{disputeId}/resolve": {
      "post": {
        "operationId": "resolveDispute",
        "summary": "Resolves a dispute with the outcome the person chose.",
        "description": "Resolves a dispute with the outcome the person chose. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:approve",
        "parameters": [
          {
            "name": "disputeId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "resolution": {
                    "type": "string",
                    "minLength": 10,
                    "maxLength": 2000
                  }
                },
                "required": [
                  "resolution"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "Ledger-Position": {
                "$ref": "#/components/headers/LedgerPosition"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListDisputesResponseItem"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem400"
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "404": {
            "$ref": "#/components/responses/Problem404"
          },
          "409": {
            "$ref": "#/components/responses/Problem409"
          },
          "412": {
            "$ref": "#/components/responses/Problem412"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/products": {
      "get": {
        "operationId": "listProducts",
        "summary": "Lists the products and services in the catalogue, with the server's total.",
        "description": "Lists the products and services in the catalogue, with the server's total. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "ACTIVE",
                "ARCHIVED"
              ]
            }
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 100
            }
          },
          {
            "name": "supplyCategory",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "GOODS",
                "SERVICES",
                "INTANGIBLE_PROPERTY",
                "REAL_PROPERTY"
              ]
            }
          },
          {
            "name": "treatment",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "STANDARD",
                "ZERO_RATED",
                "EXEMPT",
                "OUT_OF_SCOPE",
                "RELIEVED"
              ]
            }
          },
          {
            "name": "accountId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "priceFromMinor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^-?\\d+$"
            }
          },
          {
            "name": "priceToMinor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^-?\\d+$"
            }
          },
          {
            "name": "kind",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "REVENUE",
                "NON_REVENUE"
              ]
            }
          },
          {
            "name": "chargeKind",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "FREIGHT",
                "FREIGHT_INSURANCE"
              ]
            }
          },
          {
            "name": "cf",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 4000
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 512
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ListProductsResponseItem"
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "total": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "data",
                    "nextCursor",
                    "total"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      },
      "post": {
        "operationId": "createProduct",
        "summary": "Creates a product or service in the catalogue.",
        "description": "Creates a product or service in the catalogue. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 40
                  },
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "description": {
                    "type": "string",
                    "maxLength": 500
                  },
                  "supplyCategory": {
                    "type": "string",
                    "enum": [
                      "GOODS",
                      "SERVICES",
                      "INTANGIBLE_PROPERTY",
                      "REAL_PROPERTY"
                    ]
                  },
                  "treatmentHint": {
                    "type": "string",
                    "enum": [
                      "STANDARD",
                      "ZERO_RATED",
                      "EXEMPT",
                      "OUT_OF_SCOPE"
                    ]
                  },
                  "treatmentReason": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 500
                  },
                  "treatmentCondition": {
                    "type": "string",
                    "enum": [
                      "ANY_RECIPIENT",
                      "NON_RESIDENT_RECIPIENT"
                    ]
                  },
                  "revenueAccountId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "kind": {
                    "type": "string",
                    "enum": [
                      "REVENUE",
                      "NON_REVENUE"
                    ]
                  },
                  "countryOfOrigin": {
                    "type": "string",
                    "pattern": "^[A-Z]{2}$"
                  },
                  "hsCode": {
                    "type": "string",
                    "pattern": "^[0-9]{6,10}$"
                  },
                  "chargeKind": {
                    "anyOf": [
                      {
                        "type": "string",
                        "enum": [
                          "FREIGHT",
                          "FREIGHT_INSURANCE"
                        ]
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "deferredAccountId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "unitPriceMinor": {
                    "type": "string",
                    "pattern": "^-?\\d+$"
                  },
                  "currency": {
                    "type": "string",
                    "pattern": "^[A-Z]{3}$"
                  },
                  "customFields": {
                    "$ref": "#/components/schemas/CustomFields"
                  }
                },
                "required": [
                  "code",
                  "name",
                  "supplyCategory"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "Ledger-Position": {
                "$ref": "#/components/headers/LedgerPosition"
              },
              "Location": {
                "$ref": "#/components/headers/Location"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListProductsResponseItem"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem400"
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "409": {
            "$ref": "#/components/responses/Problem409"
          },
          "412": {
            "$ref": "#/components/responses/Problem412"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/products/settings": {
      "get": {
        "operationId": "getCatalogueSettings",
        "summary": "Returns the product catalogue settings of the ledger.",
        "description": "Returns the product catalogue settings of the ledger. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [],
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetCatalogueSettingsResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      },
      "patch": {
        "operationId": "updateCatalogueSettings",
        "summary": "Changes the product catalogue settings of the ledger.",
        "description": "Changes the product catalogue settings of the ledger. Needs the `ledger:admin` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:admin",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "revenueAccountId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "supplyCategory": {
                    "anyOf": [
                      {
                        "type": "string",
                        "enum": [
                          "GOODS",
                          "SERVICES",
                          "INTANGIBLE_PROPERTY",
                          "REAL_PROPERTY"
                        ]
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "Ledger-Position": {
                "$ref": "#/components/headers/LedgerPosition"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetCatalogueSettingsResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem400"
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "409": {
            "$ref": "#/components/responses/Problem409"
          },
          "412": {
            "$ref": "#/components/responses/Problem412"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/products/{productId}": {
      "get": {
        "operationId": "getProduct",
        "summary": "Returns one product or service with its prices and tax.",
        "description": "Returns one product or service with its prices and tax. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "productId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListProductsResponseItem"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "404": {
            "$ref": "#/components/responses/Problem404"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      },
      "patch": {
        "operationId": "updateProduct",
        "summary": "Changes a product or service.",
        "description": "Changes a product or service. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "productId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 40
                  },
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "description": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 500
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "supplyCategory": {
                    "type": "string",
                    "enum": [
                      "GOODS",
                      "SERVICES",
                      "INTANGIBLE_PROPERTY",
                      "REAL_PROPERTY"
                    ]
                  },
                  "treatmentHint": {
                    "anyOf": [
                      {
                        "type": "string",
                        "enum": [
                          "STANDARD",
                          "ZERO_RATED",
                          "EXEMPT",
                          "OUT_OF_SCOPE"
                        ]
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "treatmentReason": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 500
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "treatmentCondition": {
                    "type": "string",
                    "enum": [
                      "ANY_RECIPIENT",
                      "NON_RESIDENT_RECIPIENT"
                    ]
                  },
                  "revenueAccountId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "kind": {
                    "type": "string",
                    "enum": [
                      "REVENUE",
                      "NON_REVENUE"
                    ]
                  },
                  "countryOfOrigin": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^[A-Z]{2}$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "hsCode": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^[0-9]{6,10}$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "chargeKind": {
                    "anyOf": [
                      {
                        "type": "string",
                        "enum": [
                          "FREIGHT",
                          "FREIGHT_INSURANCE"
                        ]
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "deferredAccountId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "unitPriceMinor": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^-?\\d+$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "currency": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^[A-Z]{3}$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "customFields": {
                    "$ref": "#/components/schemas/CustomFields6"
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "Ledger-Position": {
                "$ref": "#/components/headers/LedgerPosition"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListProductsResponseItem"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem400"
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "404": {
            "$ref": "#/components/responses/Problem404"
          },
          "409": {
            "$ref": "#/components/responses/Problem409"
          },
          "412": {
            "$ref": "#/components/responses/Problem412"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/products/{productId}/archive": {
      "post": {
        "operationId": "archiveProduct",
        "summary": "Archives a product so it is no longer offered on invoices.",
        "description": "Archives a product so it is no longer offered on invoices. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:approve",
        "parameters": [
          {
            "name": "productId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "reason": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 500
                  }
                },
                "required": [
                  "reason"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "Ledger-Position": {
                "$ref": "#/components/headers/LedgerPosition"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListProductsResponseItem"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem400"
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "404": {
            "$ref": "#/components/responses/Problem404"
          },
          "409": {
            "$ref": "#/components/responses/Problem409"
          },
          "412": {
            "$ref": "#/components/responses/Problem412"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/products/{productId}/restore": {
      "post": {
        "operationId": "restoreProduct",
        "summary": "Restores an archived product.",
        "description": "Restores an archived product. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:approve",
        "parameters": [
          {
            "name": "productId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "Ledger-Position": {
                "$ref": "#/components/headers/LedgerPosition"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListProductsResponseItem"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem400"
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "404": {
            "$ref": "#/components/responses/Problem404"
          },
          "409": {
            "$ref": "#/components/responses/Problem409"
          },
          "412": {
            "$ref": "#/components/responses/Problem412"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/receivables-audit-packages": {
      "post": {
        "operationId": "requestReceivablesAuditPackage",
        "summary": "Requests an audit package of the receivables at a period end, built in the background for the auditor.",
        "description": "Requests an audit package of the receivables at a period end, built in the background for the auditor. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:approve",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "entityId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "periodEnd": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  },
                  "receiptDays": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 366
                  },
                  "cutOffDays": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 90
                  },
                  "confirmationThresholdMinor": {
                    "type": "string",
                    "pattern": "^-?\\d+$"
                  },
                  "confirmationTopN": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 1000
                  },
                  "auditorFirmName": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "auditorReplyAddress": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 1000
                  }
                },
                "required": [
                  "entityId",
                  "periodEnd",
                  "auditorFirmName",
                  "auditorReplyAddress"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Accepted: the work is done after the answer, or waits for a person's confirmation.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "Ledger-Position": {
                "$ref": "#/components/headers/LedgerPosition"
              },
              "Location": {
                "$ref": "#/components/headers/Location"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/RequestReceivablesAuditPackageResponseOption1"
                    },
                    {
                      "$ref": "#/components/schemas/UndoAgentBatchResponse"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem400"
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "409": {
            "$ref": "#/components/responses/Problem409"
          },
          "412": {
            "$ref": "#/components/responses/Problem412"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      },
      "get": {
        "operationId": "listReceivablesAuditPackages",
        "summary": "Lists the receivables audit packages and where each one stands.",
        "description": "Lists the receivables audit packages and where each one stands. Needs the `statements:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "statements:read",
        "parameters": [
          {
            "name": "entityId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "state",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "QUEUED",
                "BUILDING",
                "READY",
                "FAILED"
              ]
            }
          },
          {
            "name": "periodEnd",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
            }
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 200
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 512
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/RequestReceivablesAuditPackageResponseOption1"
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "total": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "data",
                    "nextCursor",
                    "total"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/receivables-audit-packages/{packageId}": {
      "get": {
        "operationId": "getReceivablesAuditPackage",
        "summary": "Returns one receivables audit package with its contents.",
        "description": "Returns one receivables audit package with its contents. Needs the `statements:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "statements:read",
        "parameters": [
          {
            "name": "packageId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "package": {
                      "$ref": "#/components/schemas/RequestReceivablesAuditPackageResponseOption1"
                    },
                    "companyName": {
                      "type": "string"
                    },
                    "downloads": {
                      "type": "object",
                      "properties": {
                        "total": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "recent": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/LastReplayOption1"
                          }
                        }
                      },
                      "required": [
                        "total",
                        "recent"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "package",
                    "companyName",
                    "downloads"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "404": {
            "$ref": "#/components/responses/Problem404"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/receivables/ageing": {
      "get": {
        "operationId": "getAgeing",
        "summary": "Returns the receivables ageing of the ledger.",
        "description": "Returns the receivables ageing of the ledger. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "entityId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "asOf",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
            }
          },
          {
            "name": "withChildren",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "yes",
                "no"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "asOf": {
                      "type": "string",
                      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                    },
                    "currency": {
                      "type": "string",
                      "pattern": "^[A-Z]{3}$"
                    },
                    "totals": {
                      "type": "object",
                      "properties": {
                        "current": {
                          "type": "string",
                          "pattern": "^-?\\d+$"
                        },
                        "d1to30": {
                          "type": "string",
                          "pattern": "^-?\\d+$"
                        },
                        "d31to60": {
                          "type": "string",
                          "pattern": "^-?\\d+$"
                        },
                        "d61to90": {
                          "type": "string",
                          "pattern": "^-?\\d+$"
                        },
                        "over90": {
                          "type": "string",
                          "pattern": "^-?\\d+$"
                        },
                        "total": {
                          "type": "string",
                          "pattern": "^-?\\d+$"
                        },
                        "unappliedMinor": {
                          "type": "string",
                          "pattern": "^-?\\d+$"
                        }
                      },
                      "required": [
                        "current",
                        "d1to30",
                        "d31to60",
                        "d61to90",
                        "over90",
                        "total",
                        "unappliedMinor"
                      ],
                      "additionalProperties": false
                    },
                    "openInvoiceCount": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "customers": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "current": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "d1to30": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "d31to60": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "d61to90": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "over90": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "total": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "customer": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "displayName": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "id",
                              "displayName"
                            ],
                            "additionalProperties": false
                          },
                          "unappliedMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "oldestDueDate": {
                            "anyOf": [
                              {
                                "type": "string",
                                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "daysLate": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "exclusiveMinimum": 0,
                                "maximum": 9007199254740991
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "lastContact": {
                            "$ref": "#/components/schemas/LastContact"
                          },
                          "lateDiscountClaimedMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "children": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "current": {
                                  "type": "string",
                                  "pattern": "^-?\\d+$"
                                },
                                "d1to30": {
                                  "type": "string",
                                  "pattern": "^-?\\d+$"
                                },
                                "d31to60": {
                                  "type": "string",
                                  "pattern": "^-?\\d+$"
                                },
                                "d61to90": {
                                  "type": "string",
                                  "pattern": "^-?\\d+$"
                                },
                                "over90": {
                                  "type": "string",
                                  "pattern": "^-?\\d+$"
                                },
                                "total": {
                                  "type": "string",
                                  "pattern": "^-?\\d+$"
                                },
                                "customer": {
                                  "type": "object",
                                  "properties": {
                                    "id": {
                                      "type": "string"
                                    },
                                    "displayName": {
                                      "type": "string"
                                    }
                                  },
                                  "required": [
                                    "id",
                                    "displayName"
                                  ],
                                  "additionalProperties": false
                                },
                                "unappliedMinor": {
                                  "type": "string",
                                  "pattern": "^-?\\d+$"
                                },
                                "oldestDueDate": {
                                  "anyOf": [
                                    {
                                      "type": "string",
                                      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "daysLate": {
                                  "anyOf": [
                                    {
                                      "type": "integer",
                                      "exclusiveMinimum": 0,
                                      "maximum": 9007199254740991
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "lastContact": {
                                  "$ref": "#/components/schemas/LastContact"
                                }
                              },
                              "required": [
                                "current",
                                "d1to30",
                                "d31to60",
                                "d61to90",
                                "over90",
                                "total",
                                "customer",
                                "unappliedMinor",
                                "oldestDueDate",
                                "daysLate"
                              ],
                              "additionalProperties": false
                            }
                          }
                        },
                        "required": [
                          "current",
                          "d1to30",
                          "d31to60",
                          "d61to90",
                          "over90",
                          "total",
                          "customer",
                          "unappliedMinor",
                          "oldestDueDate",
                          "daysLate"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "truncated": {
                      "type": "boolean"
                    },
                    "exchangeDifference": {
                      "type": "object",
                      "properties": {
                        "entityName": {
                          "type": "string"
                        },
                        "accountNominated": {
                          "type": "boolean"
                        },
                        "unclearedMinor": {
                          "type": "string",
                          "pattern": "^-?\\d+$"
                        }
                      },
                      "required": [
                        "entityName",
                        "accountNominated",
                        "unclearedMinor"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "asOf",
                    "currency",
                    "totals",
                    "openInvoiceCount",
                    "customers",
                    "truncated",
                    "exchangeDifference"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/receivables/allocation-proposal": {
      "get": {
        "operationId": "proposeReceiptAllocation",
        "summary": "Proposes how a receipt should be allocated across open invoices.",
        "description": "Proposes how a receipt should be allocated across open invoices. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "customerId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "entityId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "currency",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[A-Z]{3}$"
            }
          },
          {
            "name": "amountMinor",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^-?\\d+$"
            }
          },
          {
            "name": "reference",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 120
            }
          },
          {
            "name": "receivedOn",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "basis": {
                      "type": "string",
                      "enum": [
                        "REFERENCE",
                        "EXACT_SUM",
                        "OLDEST_FIRST",
                        "NONE"
                      ]
                    },
                    "sentence": {
                      "type": "string"
                    },
                    "lines": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "invoiceId": {
                            "type": "string"
                          },
                          "amountMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "discountMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          }
                        },
                        "required": [
                          "invoiceId",
                          "amountMinor"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "unallocatedMinor": {
                      "type": "string",
                      "pattern": "^-?\\d+$"
                    }
                  },
                  "required": [
                    "basis",
                    "sentence",
                    "lines",
                    "unallocatedMinor"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/receivables/credit-memo-proposals": {
      "get": {
        "operationId": "listCreditMemoProposals",
        "summary": "Lists the credit memos proposed from outside documents, waiting for a decision.",
        "description": "Lists the credit memos proposed from outside documents, waiting for a decision. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "entityId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 512
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "proposalId": {
                            "type": "string"
                          },
                          "creditMemoId": {
                            "type": "string"
                          },
                          "entityId": {
                            "type": "string"
                          },
                          "entityName": {
                            "type": "string"
                          },
                          "customer": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "displayName": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "id",
                              "displayName"
                            ],
                            "additionalProperties": false
                          },
                          "number": {
                            "type": "string"
                          },
                          "issueDate": {
                            "type": "string",
                            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                          },
                          "currency": {
                            "type": "string",
                            "pattern": "^[A-Z]{3}$"
                          },
                          "totalMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "reason": {
                            "type": "string"
                          },
                          "adjustsInvoice": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "number": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "id",
                                  "number"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "lineCount": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "submittedAt": {
                            "type": "string",
                            "minLength": 20
                          },
                          "submittedBy": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "name": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "id",
                                  "name"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "note": {
                            "type": "string"
                          },
                          "warnings": {
                            "$ref": "#/components/schemas/Warnings2"
                          }
                        },
                        "required": [
                          "proposalId",
                          "creditMemoId",
                          "entityId",
                          "entityName",
                          "customer",
                          "number",
                          "issueDate",
                          "currency",
                          "totalMinor",
                          "reason",
                          "adjustsInvoice",
                          "lineCount",
                          "submittedAt",
                          "submittedBy",
                          "note",
                          "warnings"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "total": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "data",
                    "nextCursor",
                    "total"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/receivables/credit-memos": {
      "get": {
        "operationId": "listCreditMemos",
        "summary": "Lists the credit memos, with the server's total.",
        "description": "Lists the credit memos, with the server's total. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "entityId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "customerId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            }
          },
          {
            "name": "when",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "all",
                "live",
                "unapplied"
              ]
            }
          },
          {
            "name": "issuedFrom",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
            }
          },
          {
            "name": "issuedTo",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
            }
          },
          {
            "name": "adjustsInvoiceId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "contractId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            }
          },
          {
            "name": "currency",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^[A-Z]{3}$"
            }
          },
          {
            "name": "cf",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 4000
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 512
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "entityId": {
                            "type": "string"
                          },
                          "entityName": {
                            "type": "string"
                          },
                          "customer": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "displayName": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "id",
                              "displayName"
                            ],
                            "additionalProperties": false
                          },
                          "number": {
                            "type": "string"
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "DRAFT",
                              "APPROVED",
                              "APPLIED",
                              "VOID"
                            ]
                          },
                          "issueDate": {
                            "type": "string",
                            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                          },
                          "currency": {
                            "type": "string",
                            "pattern": "^[A-Z]{3}$"
                          },
                          "subtotalMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "taxMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "totalMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "appliedMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "unappliedMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "refundedMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "warnings": {
                            "$ref": "#/components/schemas/Warnings2"
                          },
                          "reason": {
                            "type": "string"
                          },
                          "adjustsInvoice": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "number": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "id",
                                  "number"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "lineCount": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "preGoLive": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "goLiveDate": {
                                    "type": "string",
                                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                                  }
                                },
                                "required": [
                                  "goLiveDate"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "entryId": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "entryNumber": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "entryStatus": {
                            "type": [
                              "string",
                              "null"
                            ]
                          }
                        },
                        "required": [
                          "id",
                          "entityId",
                          "entityName",
                          "customer",
                          "number",
                          "status",
                          "issueDate",
                          "currency",
                          "subtotalMinor",
                          "taxMinor",
                          "totalMinor",
                          "appliedMinor",
                          "unappliedMinor",
                          "refundedMinor",
                          "warnings",
                          "reason",
                          "adjustsInvoice",
                          "lineCount",
                          "entryId",
                          "entryNumber",
                          "entryStatus"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "total": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "data",
                    "nextCursor",
                    "total"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      },
      "post": {
        "operationId": "createCreditMemo",
        "summary": "Creates a draft credit memo for a customer.",
        "description": "Creates a draft credit memo for a customer. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "entityId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "customerId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "issueDate": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  },
                  "currency": {
                    "type": "string",
                    "pattern": "^[A-Z]{3}$"
                  },
                  "receivableAccountId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "adjustsInvoiceId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "reason": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 500
                  },
                  "memo": {
                    "type": "string",
                    "maxLength": 500
                  },
                  "lines": {
                    "$ref": "#/components/schemas/Lines5"
                  },
                  "customFields": {
                    "$ref": "#/components/schemas/CustomFields"
                  }
                },
                "required": [
                  "entityId",
                  "customerId",
                  "issueDate",
                  "reason",
                  "lines"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "Ledger-Position": {
                "$ref": "#/components/headers/LedgerPosition"
              },
              "Location": {
                "$ref": "#/components/headers/Location"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreateCreditMemoResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem400"
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "409": {
            "$ref": "#/components/responses/Problem409"
          },
          "412": {
            "$ref": "#/components/responses/Problem412"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/receivables/credit-memos/{creditMemoId}": {
      "get": {
        "operationId": "getCreditMemo",
        "summary": "Returns one credit memo with its lines and status.",
        "description": "Returns one credit memo with its lines and status. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "creditMemoId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreateCreditMemoResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "404": {
            "$ref": "#/components/responses/Problem404"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      },
      "patch": {
        "operationId": "updateCreditMemo",
        "summary": "Changes a draft credit memo.",
        "description": "Changes a draft credit memo. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "creditMemoId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "customerId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "issueDate": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  },
                  "currency": {
                    "type": "string",
                    "pattern": "^[A-Z]{3}$"
                  },
                  "receivableAccountId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "adjustsInvoiceId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "reason": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 500
                  },
                  "memo": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 500
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "lines": {
                    "$ref": "#/components/schemas/Lines5"
                  },
                  "customFields": {
                    "$ref": "#/components/schemas/CustomFields6"
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "Ledger-Position": {
                "$ref": "#/components/headers/LedgerPosition"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreateCreditMemoResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem400"
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "404": {
            "$ref": "#/components/responses/Problem404"
          },
          "409": {
            "$ref": "#/components/responses/Problem409"
          },
          "412": {
            "$ref": "#/components/responses/Problem412"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      },
      "delete": {
        "operationId": "discardCreditMemo",
        "summary": "Discards a draft credit memo that has not been submitted.",
        "description": "Discards a draft credit memo that has not been submitted. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "creditMemoId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "Ledger-Position": {
                "$ref": "#/components/headers/LedgerPosition"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "number": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "id",
                    "number"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem400"
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "404": {
            "$ref": "#/components/responses/Problem404"
          },
          "409": {
            "$ref": "#/components/responses/Problem409"
          },
          "412": {
            "$ref": "#/components/responses/Problem412"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/receivables/credit-memos/{creditMemoId}/apply": {
      "post": {
        "operationId": "applyCreditMemo",
        "summary": "Applies a credit memo against an open invoice.",
        "description": "Applies a credit memo against an open invoice. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "creditMemoId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "applications": {
                    "minItems": 1,
                    "maxItems": 200,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "invoiceId": {
                          "type": "string",
                          "minLength": 1
                        },
                        "amountMinor": {
                          "type": "string",
                          "pattern": "^-?\\d+$"
                        }
                      },
                      "required": [
                        "invoiceId",
                        "amountMinor"
                      ],
                      "additionalProperties": false
                    }
                  }
                },
                "required": [
                  "applications"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "Ledger-Position": {
                "$ref": "#/components/headers/LedgerPosition"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreateCreditMemoResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem400"
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "404": {
            "$ref": "#/components/responses/Problem404"
          },
          "409": {
            "$ref": "#/components/responses/Problem409"
          },
          "412": {
            "$ref": "#/components/responses/Problem412"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/receivables/credit-memos/{creditMemoId}/approve": {
      "post": {
        "operationId": "approveCreditMemo",
        "summary": "Approves a credit memo so that it can be applied or issued.",
        "description": "Approves a credit memo so that it can be applied or issued. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:approve",
        "parameters": [
          {
            "name": "creditMemoId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "note": {
                    "type": "string",
                    "maxLength": 500
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "Ledger-Position": {
                "$ref": "#/components/headers/LedgerPosition"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreateCreditMemoResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem400"
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "404": {
            "$ref": "#/components/responses/Problem404"
          },
          "409": {
            "$ref": "#/components/responses/Problem409"
          },
          "412": {
            "$ref": "#/components/responses/Problem412"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/receivables/credit-memos/{creditMemoId}/decline": {
      "post": {
        "operationId": "declineCreditMemo",
        "summary": "Declines a submitted credit memo with a reason.",
        "description": "Declines a submitted credit memo with a reason. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:approve",
        "parameters": [
          {
            "name": "creditMemoId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "reason": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 500
                  }
                },
                "required": [
                  "reason"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "Ledger-Position": {
                "$ref": "#/components/headers/LedgerPosition"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreateCreditMemoResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem400"
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "404": {
            "$ref": "#/components/responses/Problem404"
          },
          "409": {
            "$ref": "#/components/responses/Problem409"
          },
          "412": {
            "$ref": "#/components/responses/Problem412"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/receivables/credit-memos/{creditMemoId}/send": {
      "post": {
        "operationId": "sendCreditMemo",
        "summary": "Sends a credit memo to the customer.",
        "description": "Sends a credit memo to the customer. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "creditMemoId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {},
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "Ledger-Position": {
                "$ref": "#/components/headers/LedgerPosition"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SendCustomerStatementResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem400"
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "404": {
            "$ref": "#/components/responses/Problem404"
          },
          "409": {
            "$ref": "#/components/responses/Problem409"
          },
          "412": {
            "$ref": "#/components/responses/Problem412"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/receivables/credit-memos/{creditMemoId}/submit": {
      "post": {
        "operationId": "submitCreditMemo",
        "summary": "Submits a credit memo for approval.",
        "description": "Submits a credit memo for approval. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "creditMemoId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "note": {
                    "type": "string",
                    "maxLength": 500
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "Ledger-Position": {
                "$ref": "#/components/headers/LedgerPosition"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreateCreditMemoResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem400"
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "404": {
            "$ref": "#/components/responses/Problem404"
          },
          "409": {
            "$ref": "#/components/responses/Problem409"
          },
          "412": {
            "$ref": "#/components/responses/Problem412"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/receivables/credit-memos/{creditMemoId}/void": {
      "post": {
        "operationId": "voidCreditMemo",
        "summary": "Voids a credit memo, reversing its posting.",
        "description": "Voids a credit memo, reversing its posting. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:approve",
        "parameters": [
          {
            "name": "creditMemoId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "reason": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 500
                  }
                },
                "required": [
                  "reason"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "Ledger-Position": {
                "$ref": "#/components/headers/LedgerPosition"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreateCreditMemoResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem400"
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "404": {
            "$ref": "#/components/responses/Problem404"
          },
          "409": {
            "$ref": "#/components/responses/Problem409"
          },
          "412": {
            "$ref": "#/components/responses/Problem412"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/receivables/import-reverts": {
      "get": {
        "operationId": "listInvoiceImportReverts",
        "summary": "Lists the proposed and decided reverts of invoice imports.",
        "description": "Lists the proposed and decided reverts of invoice imports. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 512
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "proposalId": {
                            "type": "string"
                          },
                          "importId": {
                            "type": "string"
                          },
                          "fileName": {
                            "type": "string"
                          },
                          "entityId": {
                            "type": "string"
                          },
                          "entityName": {
                            "type": "string"
                          },
                          "invoiceCount": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "totalMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "currency": {
                            "type": "string"
                          },
                          "reason": {
                            "type": "string"
                          },
                          "proposedBy": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "id",
                              "name"
                            ],
                            "additionalProperties": false
                          },
                          "proposedAt": {
                            "type": "string",
                            "minLength": 20
                          }
                        },
                        "required": [
                          "proposalId",
                          "importId",
                          "fileName",
                          "entityId",
                          "entityName",
                          "invoiceCount",
                          "totalMinor",
                          "currency",
                          "reason",
                          "proposedBy",
                          "proposedAt"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "total": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "data",
                    "nextCursor",
                    "total"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/receivables/imports": {
      "get": {
        "operationId": "listInvoiceImports",
        "summary": "Lists the invoice imports, with the server's total.",
        "description": "Lists the invoice imports, with the server's total. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "entityId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "REVIEW",
                "RECEIVED",
                "REVERTED"
              ]
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 512
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "entityId": {
                            "type": "string"
                          },
                          "entityName": {
                            "type": "string"
                          },
                          "fileName": {
                            "type": "string"
                          },
                          "source": {
                            "type": "string",
                            "enum": [
                              "CSV",
                              "PDF",
                              "EMAIL",
                              "QBO",
                              "HUBSPOT",
                              "XERO",
                              "STRIPE",
                              "SHOPIFY",
                              "SQUARE",
                              "AMAZON",
                              "HELCIM",
                              "MIRAKL",
                              "WOOCOMMERCE",
                              "BIGCOMMERCE",
                              "MAGENTO"
                            ]
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "REVIEW",
                              "RECEIVED",
                              "REVERTED"
                            ]
                          },
                          "counts": {
                            "$ref": "#/components/schemas/Counts2"
                          },
                          "uploadedBy": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "id",
                              "name"
                            ],
                            "additionalProperties": false
                          },
                          "createdAt": {
                            "type": "string",
                            "minLength": 20
                          },
                          "receivedAt": {
                            "anyOf": [
                              {
                                "type": "string",
                                "minLength": 20
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "revertProposalId": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "revertStatus": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "revertProposedBy": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "name": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "id",
                                  "name"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "revertedBy": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "name": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "id",
                                  "name"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "revertedAt": {
                            "anyOf": [
                              {
                                "type": "string",
                                "minLength": 20
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "revertReason": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "reading": {
                            "$ref": "#/components/schemas/Reading2"
                          },
                          "documentId": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "documentKind": {
                            "type": "string",
                            "enum": [
                              "INVOICE",
                              "CUSTOMER_PO"
                            ]
                          },
                          "duplicateOf": {
                            "$ref": "#/components/schemas/DuplicateOf"
                          }
                        },
                        "required": [
                          "id",
                          "entityId",
                          "entityName",
                          "fileName",
                          "source",
                          "status",
                          "counts",
                          "uploadedBy",
                          "createdAt",
                          "receivedAt",
                          "revertProposalId",
                          "revertStatus",
                          "revertProposedBy",
                          "revertedBy",
                          "revertedAt",
                          "revertReason",
                          "reading",
                          "documentId"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "total": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "data",
                    "nextCursor",
                    "total"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      },
      "post": {
        "operationId": "createInvoiceImport",
        "summary": "Starts an import of invoices from a file.",
        "description": "Starts an import of invoices from a file. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "entityId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "fileName": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 255
                  },
                  "source": {
                    "default": "CSV",
                    "type": "string",
                    "enum": [
                      "CSV",
                      "PDF",
                      "EMAIL",
                      "QBO",
                      "HUBSPOT",
                      "XERO",
                      "STRIPE",
                      "SHOPIFY",
                      "SQUARE",
                      "AMAZON",
                      "HELCIM",
                      "MIRAKL",
                      "WOOCOMMERCE",
                      "BIGCOMMERCE",
                      "MAGENTO"
                    ]
                  },
                  "receivableAccountId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "csv": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 1000000
                  },
                  "mapping": {
                    "$ref": "#/components/schemas/Mapping"
                  },
                  "defaults": {
                    "type": "object",
                    "properties": {
                      "region": {
                        "default": null,
                        "anyOf": [
                          {
                            "type": "string",
                            "maxLength": 10
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "accountId": {
                        "default": null,
                        "anyOf": [
                          {
                            "type": "string",
                            "maxLength": 64
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "supplyCategory": {
                        "default": "SERVICES",
                        "type": "string",
                        "enum": [
                          "GOODS",
                          "SERVICES",
                          "INTANGIBLE_PROPERTY",
                          "REAL_PROPERTY"
                        ]
                      },
                      "dayFirst": {
                        "default": false,
                        "type": "boolean"
                      },
                      "currency": {
                        "type": "string",
                        "pattern": "^[A-Z]{3}$"
                      },
                      "dimensions": {
                        "default": [],
                        "maxItems": 20,
                        "type": "array",
                        "items": {
                          "$ref": "#/components/schemas/DimensionsItem"
                        }
                      }
                    },
                    "required": [
                      "currency"
                    ],
                    "additionalProperties": false
                  },
                  "documentKind": {
                    "type": "string",
                    "enum": [
                      "INVOICE",
                      "CUSTOMER_PO"
                    ]
                  }
                },
                "required": [
                  "entityId",
                  "fileName",
                  "receivableAccountId",
                  "csv",
                  "defaults"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "Ledger-Position": {
                "$ref": "#/components/headers/LedgerPosition"
              },
              "Location": {
                "$ref": "#/components/headers/Location"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreateInvoiceImportResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem400"
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "409": {
            "$ref": "#/components/responses/Problem409"
          },
          "412": {
            "$ref": "#/components/responses/Problem412"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/receivables/imports/{importId}": {
      "get": {
        "operationId": "getInvoiceImport",
        "summary": "Returns one invoice import with its rows.",
        "description": "Returns one invoice import with its rows. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "importId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 512
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreateInvoiceImportResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "404": {
            "$ref": "#/components/responses/Problem404"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      },
      "patch": {
        "operationId": "updateInvoiceImport",
        "summary": "Changes an invoice import before it is received.",
        "description": "Changes an invoice import before it is received. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "importId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "dimensions": {
                    "$ref": "#/components/schemas/Dimensions2"
                  }
                },
                "required": [
                  "dimensions"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "Ledger-Position": {
                "$ref": "#/components/headers/LedgerPosition"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreateInvoiceImportResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem400"
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "404": {
            "$ref": "#/components/responses/Problem404"
          },
          "409": {
            "$ref": "#/components/responses/Problem409"
          },
          "412": {
            "$ref": "#/components/responses/Problem412"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/receivables/imports/{importId}/receive": {
      "post": {
        "operationId": "receiveInvoiceImport",
        "summary": "Receives an invoice import, which creates its invoices.",
        "description": "Receives an invoice import, which creates its invoices. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "importId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {},
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "Ledger-Position": {
                "$ref": "#/components/headers/LedgerPosition"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreateInvoiceImportResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem400"
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "404": {
            "$ref": "#/components/responses/Problem404"
          },
          "409": {
            "$ref": "#/components/responses/Problem409"
          },
          "412": {
            "$ref": "#/components/responses/Problem412"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/receivables/imports/{importId}/revert": {
      "post": {
        "operationId": "proposeInvoiceImportRevert",
        "summary": "Proposes reverting an invoice import, for a person to decide.",
        "description": "Proposes reverting an invoice import, for a person to decide. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "importId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "reason": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 500
                  }
                },
                "required": [
                  "reason"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "Ledger-Position": {
                "$ref": "#/components/headers/LedgerPosition"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreateInvoiceImportResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem400"
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "404": {
            "$ref": "#/components/responses/Problem404"
          },
          "409": {
            "$ref": "#/components/responses/Problem409"
          },
          "412": {
            "$ref": "#/components/responses/Problem412"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/receivables/imports/{importId}/revert/decide": {
      "post": {
        "operationId": "decideInvoiceImportRevert",
        "summary": "Accepts or declines the revert of an invoice import.",
        "description": "Accepts or declines the revert of an invoice import. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:approve",
        "parameters": [
          {
            "name": "importId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "decision": {
                    "type": "string",
                    "enum": [
                      "APPROVE",
                      "REJECT"
                    ]
                  },
                  "reason": {
                    "type": "string",
                    "maxLength": 500
                  }
                },
                "required": [
                  "decision"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "Ledger-Position": {
                "$ref": "#/components/headers/LedgerPosition"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreateInvoiceImportResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem400"
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "404": {
            "$ref": "#/components/responses/Problem404"
          },
          "409": {
            "$ref": "#/components/responses/Problem409"
          },
          "412": {
            "$ref": "#/components/responses/Problem412"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/receivables/imports/{importId}/rows/{rowId}": {
      "patch": {
        "operationId": "updateInvoiceImportRow",
        "summary": "Changes one row of an invoice import.",
        "description": "Changes one row of an invoice import. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "importId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "rowId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "cells": {
                    "type": "object",
                    "propertyNames": {
                      "$ref": "#/components/schemas/MappingValue"
                    },
                    "additionalProperties": {
                      "anyOf": [
                        {
                          "type": "string",
                          "maxLength": 500
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "dimensions": {
                    "$ref": "#/components/schemas/Dimensions2"
                  },
                  "customFields": {
                    "type": "object",
                    "propertyNames": {
                      "type": "string",
                      "pattern": "^[a-z][a-z0-9_]{0,39}$"
                    },
                    "additionalProperties": {
                      "anyOf": [
                        {
                          "type": "string",
                          "maxLength": 500
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "Ledger-Position": {
                "$ref": "#/components/headers/LedgerPosition"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "row": {
                      "$ref": "#/components/schemas/RowsItem"
                    },
                    "counts": {
                      "$ref": "#/components/schemas/Counts2"
                    }
                  },
                  "required": [
                    "row",
                    "counts"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem400"
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "404": {
            "$ref": "#/components/responses/Problem404"
          },
          "409": {
            "$ref": "#/components/responses/Problem409"
          },
          "412": {
            "$ref": "#/components/responses/Problem412"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/receivables/invoice-currencies": {
      "get": {
        "operationId": "listInvoiceCurrencies",
        "summary": "Lists the currencies invoices can be issued in.",
        "description": "Lists the currencies invoices can be issued in. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "entityId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "on",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "entityId": {
                      "type": "string"
                    },
                    "functionalCurrency": {
                      "type": "string",
                      "pattern": "^[A-Z]{3}$"
                    },
                    "on": {
                      "type": "string",
                      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "currency": {
                            "type": "string",
                            "pattern": "^[A-Z]{3}$"
                          },
                          "rate": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "rateDate": {
                            "anyOf": [
                              {
                                "type": "string",
                                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "source": {
                            "anyOf": [
                              {
                                "type": "string",
                                "enum": [
                                  "BOC",
                                  "MANUAL"
                                ]
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "newestRateOn": {
                            "anyOf": [
                              {
                                "type": "string",
                                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          }
                        },
                        "required": [
                          "currency",
                          "rate",
                          "rateDate",
                          "source",
                          "newestRateOn"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "total": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    }
                  },
                  "required": [
                    "entityId",
                    "functionalCurrency",
                    "on",
                    "data",
                    "total"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/receivables/invoice-edit-batches": {
      "post": {
        "operationId": "proposeInvoiceEditBatch",
        "summary": "Proposes a batch of invoice edits for a person to decide.",
        "description": "Proposes a batch of invoice edits for a person to decide. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "entityId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "invoiceIds": {
                    "minItems": 1,
                    "maxItems": 50,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1
                    }
                  },
                  "change": {
                    "$ref": "#/components/schemas/Change"
                  },
                  "reason": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 500
                  }
                },
                "required": [
                  "entityId",
                  "invoiceIds",
                  "change",
                  "reason"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "Ledger-Position": {
                "$ref": "#/components/headers/LedgerPosition"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "batchId": {
                      "type": "string"
                    },
                    "invoiceCount": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 9007199254740991
                    },
                    "refused": {
                      "$ref": "#/components/schemas/Refused"
                    }
                  },
                  "required": [
                    "batchId",
                    "invoiceCount",
                    "refused"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem400"
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "409": {
            "$ref": "#/components/responses/Problem409"
          },
          "412": {
            "$ref": "#/components/responses/Problem412"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      },
      "get": {
        "operationId": "listInvoiceEditBatches",
        "summary": "Lists the batches of invoice edits.",
        "description": "Lists the batches of invoice edits. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "entityId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "waiting",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "yes"
              ]
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 512
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "entityId": {
                            "type": "string"
                          },
                          "entityName": {
                            "type": "string"
                          },
                          "changeSentence": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "change": {
                            "$ref": "#/components/schemas/Change"
                          },
                          "reason": {
                            "type": "string"
                          },
                          "invoiceCount": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 9007199254740991
                          },
                          "waitingCount": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "proposedBy": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "name": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "id",
                                  "name"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "proposedAt": {
                            "type": "string",
                            "minLength": 20
                          }
                        },
                        "required": [
                          "id",
                          "entityId",
                          "entityName",
                          "changeSentence",
                          "change",
                          "reason",
                          "invoiceCount",
                          "waitingCount",
                          "proposedBy",
                          "proposedAt"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "total": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "data",
                    "nextCursor",
                    "total"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/receivables/invoice-edit-batches/preview": {
      "post": {
        "operationId": "previewInvoiceEditBatch",
        "summary": "Previews a batch of invoice edits before it is proposed.",
        "description": "Previews a batch of invoice edits before it is proposed. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-eternify-read": true,
        "x-scope": "ledger:propose",
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "entityId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "invoiceIds": {
                    "minItems": 1,
                    "maxItems": 50,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1
                    }
                  },
                  "change": {
                    "$ref": "#/components/schemas/Change"
                  }
                },
                "required": [
                  "entityId",
                  "invoiceIds",
                  "change"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "entityId": {
                      "type": "string"
                    },
                    "entityName": {
                      "type": "string"
                    },
                    "change": {
                      "$ref": "#/components/schemas/Change"
                    },
                    "taken": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "invoiceId": {
                            "type": "string"
                          },
                          "number": {
                            "type": "string"
                          },
                          "customer": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "displayName": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "id",
                              "displayName"
                            ],
                            "additionalProperties": false
                          },
                          "currency": {
                            "type": "string",
                            "pattern": "^[A-Z]{3}$"
                          },
                          "diff": {
                            "$ref": "#/components/schemas/DiffOption1"
                          },
                          "totalMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "proposedTotalMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          }
                        },
                        "required": [
                          "invoiceId",
                          "number",
                          "customer",
                          "currency",
                          "diff",
                          "totalMinor",
                          "proposedTotalMinor"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "refused": {
                      "$ref": "#/components/schemas/Refused"
                    }
                  },
                  "required": [
                    "entityId",
                    "entityName",
                    "change",
                    "taken",
                    "refused"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/receivables/invoice-edit-batches/{batchId}": {
      "get": {
        "operationId": "getInvoiceEditBatch",
        "summary": "Returns one batch of invoice edits.",
        "description": "Returns one batch of invoice edits. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "batchId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "entityId": {
                      "type": "string"
                    },
                    "entityName": {
                      "type": "string"
                    },
                    "change": {
                      "$ref": "#/components/schemas/Change"
                    },
                    "changeSentence": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "reason": {
                      "type": "string"
                    },
                    "invoiceCount": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 9007199254740991
                    },
                    "proposedBy": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string"
                            },
                            "name": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "id",
                            "name"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "proposedAt": {
                      "type": "string",
                      "minLength": 20
                    },
                    "counts": {
                      "type": "object",
                      "properties": {
                        "waiting": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "approved": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "sentBack": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "withdrawn": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        }
                      },
                      "required": [
                        "waiting",
                        "approved",
                        "sentBack",
                        "withdrawn"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "id",
                    "entityId",
                    "entityName",
                    "change",
                    "changeSentence",
                    "reason",
                    "invoiceCount",
                    "proposedBy",
                    "proposedAt",
                    "counts"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "404": {
            "$ref": "#/components/responses/Problem404"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/receivables/invoice-edit-batches/{batchId}/approve": {
      "post": {
        "operationId": "approveInvoiceEditBatch",
        "summary": "Approves a batch of invoice edits so each edit is applied.",
        "description": "Approves a batch of invoice edits so each edit is applied. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:approve",
        "parameters": [
          {
            "name": "batchId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "reason": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 500
                  },
                  "proposalIds": {
                    "minItems": 1,
                    "maxItems": 50,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1
                    }
                  }
                },
                "required": [
                  "reason",
                  "proposalIds"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "Ledger-Position": {
                "$ref": "#/components/headers/LedgerPosition"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "approved": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "failures": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "invoiceId": {
                            "type": "string"
                          },
                          "reason": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "invoiceId",
                          "reason"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "approved",
                    "failures"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem400"
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "404": {
            "$ref": "#/components/responses/Problem404"
          },
          "409": {
            "$ref": "#/components/responses/Problem409"
          },
          "412": {
            "$ref": "#/components/responses/Problem412"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/receivables/invoice-edit-batches/{batchId}/rows": {
      "get": {
        "operationId": "listInvoiceEditBatchRows",
        "summary": "Lists the invoices in one batch of invoice edits.",
        "description": "Lists the invoices in one batch of invoice edits. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "batchId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "state",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "WAITING",
                "APPROVED",
                "SENT_BACK",
                "WITHDRAWN"
              ]
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 512
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "proposalId": {
                            "type": "string"
                          },
                          "invoiceId": {
                            "type": "string"
                          },
                          "number": {
                            "type": "string"
                          },
                          "customer": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "displayName": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "id",
                              "displayName"
                            ],
                            "additionalProperties": false
                          },
                          "currency": {
                            "type": "string",
                            "pattern": "^[A-Z]{3}$"
                          },
                          "state": {
                            "type": "string",
                            "enum": [
                              "WAITING",
                              "APPROVED",
                              "SENT_BACK",
                              "WITHDRAWN"
                            ]
                          },
                          "diff": {
                            "$ref": "#/components/schemas/DiffOption1"
                          },
                          "totalMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "proposedTotalMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "decidedBy": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "name": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "id",
                                  "name"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "decidedAt": {
                            "anyOf": [
                              {
                                "type": "string",
                                "minLength": 20
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "decisionReason": {
                            "type": [
                              "string",
                              "null"
                            ]
                          }
                        },
                        "required": [
                          "proposalId",
                          "invoiceId",
                          "number",
                          "customer",
                          "currency",
                          "state",
                          "diff",
                          "totalMinor",
                          "proposedTotalMinor",
                          "decidedBy",
                          "decidedAt",
                          "decisionReason"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "total": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "data",
                    "nextCursor",
                    "total"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "404": {
            "$ref": "#/components/responses/Problem404"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/receivables/invoice-edit-proposals": {
      "get": {
        "operationId": "listInvoiceEditProposals",
        "summary": "Lists the proposed invoice edits waiting for a decision.",
        "description": "Lists the proposed invoice edits waiting for a decision. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "entityId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "invoiceId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "batch",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "any",
                "none"
              ]
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 512
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "proposalId": {
                            "type": "string"
                          },
                          "invoiceId": {
                            "type": "string"
                          },
                          "entityId": {
                            "type": "string"
                          },
                          "entityName": {
                            "type": "string"
                          },
                          "customer": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "displayName": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "id",
                              "displayName"
                            ],
                            "additionalProperties": false
                          },
                          "number": {
                            "type": "string"
                          },
                          "currency": {
                            "type": "string",
                            "pattern": "^[A-Z]{3}$"
                          },
                          "totalMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "proposedTotalMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "diff": {
                            "$ref": "#/components/schemas/DiffOption1"
                          },
                          "reason": {
                            "type": "string"
                          },
                          "submittedAt": {
                            "type": "string",
                            "minLength": 20
                          },
                          "submittedBy": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "name": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "id",
                                  "name"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "batchId": {
                            "type": [
                              "string",
                              "null"
                            ]
                          }
                        },
                        "required": [
                          "proposalId",
                          "invoiceId",
                          "entityId",
                          "entityName",
                          "customer",
                          "number",
                          "currency",
                          "totalMinor",
                          "proposedTotalMinor",
                          "diff",
                          "reason",
                          "submittedAt",
                          "submittedBy",
                          "batchId"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "total": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "data",
                    "nextCursor",
                    "total"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/receivables/invoice-proposals": {
      "get": {
        "operationId": "listInvoiceProposals",
        "summary": "Lists the invoices proposed from outside documents, waiting for a decision.",
        "description": "Lists the invoices proposed from outside documents, waiting for a decision. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "entityId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 512
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "proposalId": {
                            "type": "string"
                          },
                          "invoiceId": {
                            "type": "string"
                          },
                          "entityId": {
                            "type": "string"
                          },
                          "entityName": {
                            "type": "string"
                          },
                          "customer": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "displayName": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "id",
                              "displayName"
                            ],
                            "additionalProperties": false
                          },
                          "number": {
                            "type": "string"
                          },
                          "issueDate": {
                            "type": "string",
                            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                          },
                          "dueDate": {
                            "type": "string",
                            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                          },
                          "currency": {
                            "type": "string",
                            "pattern": "^[A-Z]{3}$"
                          },
                          "totalMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "lineCount": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "submittedAt": {
                            "type": "string",
                            "minLength": 20
                          },
                          "submittedBy": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "name": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "id",
                                  "name"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "note": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "proposalId",
                          "invoiceId",
                          "entityId",
                          "entityName",
                          "customer",
                          "number",
                          "issueDate",
                          "dueDate",
                          "currency",
                          "totalMinor",
                          "lineCount",
                          "submittedAt",
                          "submittedBy",
                          "note"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "total": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "data",
                    "nextCursor",
                    "total"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/receivables/invoice-sends": {
      "get": {
        "operationId": "listInvoiceSendProposals",
        "summary": "Lists the invoice sends waiting for a decision.",
        "description": "Lists the invoice sends waiting for a decision. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "entityId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "default": "PENDING",
              "type": "string",
              "enum": [
                "PENDING",
                "ALL"
              ]
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 512
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "proposalId": {
                            "type": "string"
                          },
                          "invoiceId": {
                            "type": "string"
                          },
                          "number": {
                            "type": "string"
                          },
                          "entityId": {
                            "type": "string"
                          },
                          "entityName": {
                            "type": "string"
                          },
                          "customer": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "displayName": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "id",
                              "displayName"
                            ],
                            "additionalProperties": false
                          },
                          "recipients": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "askedAt": {
                            "type": "string",
                            "minLength": 20
                          },
                          "askedBy": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "name": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "id",
                                  "name"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          }
                        },
                        "required": [
                          "proposalId",
                          "invoiceId",
                          "number",
                          "entityId",
                          "entityName",
                          "customer",
                          "recipients",
                          "askedAt",
                          "askedBy"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "total": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "data",
                    "nextCursor",
                    "total"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/receivables/invoice-tax-preview": {
      "post": {
        "operationId": "previewInvoiceTax",
        "summary": "Previews the tax an invoice would carry before it is saved.",
        "description": "Previews the tax an invoice would carry before it is saved. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-eternify-read": true,
        "x-scope": "ledger:propose",
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "entityId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "customerId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "issueDate": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  },
                  "dueDate": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  },
                  "currency": {
                    "type": "string",
                    "pattern": "^[A-Z]{3}$"
                  },
                  "receivableAccountId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "shipToAddressId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "invoiceId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "recipientPlace": {
                    "$ref": "#/components/schemas/RecipientPlace"
                  },
                  "lines": {
                    "$ref": "#/components/schemas/Lines5"
                  }
                },
                "required": [
                  "entityId",
                  "customerId",
                  "issueDate",
                  "lines"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "placeOfSupply": {
                      "type": "object",
                      "properties": {
                        "country": {
                          "type": "string"
                        },
                        "region": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "from": {
                          "type": "string",
                          "enum": [
                            "SHIP_TO",
                            "CUSTOMER"
                          ]
                        }
                      },
                      "required": [
                        "country",
                        "region",
                        "from"
                      ],
                      "additionalProperties": false
                    },
                    "shipToAddressId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "lines": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "index": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "netMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "treatment": {
                            "type": "string",
                            "enum": [
                              "STANDARD",
                              "ZERO_RATED",
                              "EXEMPT",
                              "OUT_OF_SCOPE",
                              "RELIEVED"
                            ]
                          },
                          "placeOfSupply": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "components": {
                            "$ref": "#/components/schemas/Components"
                          },
                          "taxMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "basis": {
                            "type": "string"
                          },
                          "engine": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "treatment": {
                                    "type": "string",
                                    "enum": [
                                      "STANDARD",
                                      "ZERO_RATED",
                                      "EXEMPT",
                                      "OUT_OF_SCOPE",
                                      "RELIEVED"
                                    ]
                                  },
                                  "components": {
                                    "$ref": "#/components/schemas/Components"
                                  },
                                  "taxMinor": {
                                    "type": "string",
                                    "pattern": "^-?\\d+$"
                                  }
                                },
                                "required": [
                                  "treatment",
                                  "components",
                                  "taxMinor"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "override": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "treatment": {
                                    "type": "string",
                                    "enum": [
                                      "ZERO_RATED",
                                      "EXEMPT",
                                      "OUT_OF_SCOPE"
                                    ]
                                  },
                                  "reasonGiven": {
                                    "type": "boolean"
                                  }
                                },
                                "required": [
                                  "treatment",
                                  "reasonGiven"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "provincialExemption": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "certificateId": {
                                    "type": "string"
                                  },
                                  "jurisdiction": {
                                    "type": "string"
                                  },
                                  "certificateNumber": {
                                    "type": "string"
                                  },
                                  "memo": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  }
                                },
                                "required": [
                                  "certificateId",
                                  "jurisdiction",
                                  "certificateNumber",
                                  "memo"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "precedent": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "invoiceId": {
                                    "type": "string"
                                  },
                                  "invoiceNumber": {
                                    "type": "string"
                                  },
                                  "treatment": {
                                    "type": "string",
                                    "enum": [
                                      "ZERO_RATED",
                                      "EXEMPT",
                                      "OUT_OF_SCOPE"
                                    ]
                                  },
                                  "reason": {
                                    "type": "string"
                                  },
                                  "by": {
                                    "type": "object",
                                    "properties": {
                                      "id": {
                                        "type": "string"
                                      },
                                      "name": {
                                        "type": "string"
                                      }
                                    },
                                    "required": [
                                      "id",
                                      "name"
                                    ],
                                    "additionalProperties": false
                                  },
                                  "on": {
                                    "type": "string",
                                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                                  }
                                },
                                "required": [
                                  "invoiceId",
                                  "invoiceNumber",
                                  "treatment",
                                  "reason",
                                  "by",
                                  "on"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "itemTreatment": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "treatment": {
                                    "type": "string",
                                    "enum": [
                                      "STANDARD",
                                      "ZERO_RATED",
                                      "EXEMPT",
                                      "OUT_OF_SCOPE",
                                      "RELIEVED"
                                    ]
                                  },
                                  "reason": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  },
                                  "stood": {
                                    "type": "boolean"
                                  }
                                },
                                "required": [
                                  "treatment",
                                  "reason",
                                  "stood"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "hintOverride": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "treatment": {
                                    "type": "string",
                                    "enum": [
                                      "STANDARD",
                                      "ZERO_RATED",
                                      "EXEMPT",
                                      "OUT_OF_SCOPE",
                                      "RELIEVED"
                                    ]
                                  },
                                  "explained": {
                                    "type": "string",
                                    "enum": [
                                      "GIVEN",
                                      "CARRIED",
                                      "MISSING"
                                    ]
                                  },
                                  "carriedReason": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  }
                                },
                                "required": [
                                  "treatment",
                                  "explained",
                                  "carriedReason"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          }
                        },
                        "required": [
                          "index",
                          "netMinor",
                          "treatment",
                          "placeOfSupply",
                          "components",
                          "taxMinor",
                          "basis",
                          "engine",
                          "override",
                          "provincialExemption",
                          "precedent",
                          "itemTreatment",
                          "hintOverride"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "subtotalMinor": {
                      "type": "string",
                      "pattern": "^-?\\d+$"
                    },
                    "taxMinor": {
                      "type": "string",
                      "pattern": "^-?\\d+$"
                    },
                    "totalMinor": {
                      "type": "string",
                      "pattern": "^-?\\d+$"
                    },
                    "warnings": {
                      "$ref": "#/components/schemas/Warnings"
                    },
                    "certificatesOnFile": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "certificateId": {
                            "type": "string"
                          },
                          "scope": {
                            "type": "string",
                            "enum": [
                              "PROVINCIAL_SALES_TAX",
                              "GST_HST_RELIEF",
                              "NON_RESIDENT_STATUS",
                              "EXPORT_PROOF",
                              "INDIAN_ACT_S87"
                            ]
                          },
                          "jurisdiction": {
                            "type": "string"
                          },
                          "certificateNumber": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "memo": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "sentence": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "certificateId",
                          "scope",
                          "jurisdiction",
                          "certificateNumber",
                          "memo",
                          "sentence"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "taxLines": {
                      "$ref": "#/components/schemas/TaxLines"
                    }
                  },
                  "required": [
                    "placeOfSupply",
                    "shipToAddressId",
                    "lines",
                    "subtotalMinor",
                    "taxMinor",
                    "totalMinor",
                    "certificatesOnFile"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/receivables/invoices": {
      "get": {
        "operationId": "listInvoices",
        "summary": "Lists the invoices on the ledger, with the server's total.",
        "description": "Lists the invoices on the ledger, with the server's total. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "sort",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "issued_desc",
                "issued_asc",
                "due_asc",
                "due_desc",
                "created_desc",
                "created_asc",
                "balance_desc",
                "balance_asc",
                "total_desc",
                "total_asc"
              ]
            }
          },
          {
            "name": "entityId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "customerId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "family",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            }
          },
          {
            "name": "when",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "all",
                "open",
                "overdue"
              ]
            }
          },
          {
            "name": "issuedFrom",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
            }
          },
          {
            "name": "issuedTo",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
            }
          },
          {
            "name": "dueFrom",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
            }
          },
          {
            "name": "dueTo",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
            }
          },
          {
            "name": "totalFromMinor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^-?\\d+$"
            }
          },
          {
            "name": "totalToMinor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^-?\\d+$"
            }
          },
          {
            "name": "balanceFromMinor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^-?\\d+$"
            }
          },
          {
            "name": "balanceToMinor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^-?\\d+$"
            }
          },
          {
            "name": "currency",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^[A-Z]{3}$"
            }
          },
          {
            "name": "productId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "contractId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "sent",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "yes",
                "no"
              ]
            }
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            }
          },
          {
            "name": "promised",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "yes",
                "no",
                "passed"
              ]
            }
          },
          {
            "name": "waitingOn",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "me"
              ]
            }
          },
          {
            "name": "cf",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 4000
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 512
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Data"
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "total": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "totals": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "totalMinor": {
                              "type": "string",
                              "pattern": "^-?\\d+$"
                            },
                            "balanceMinor": {
                              "type": "string",
                              "pattern": "^-?\\d+$"
                            },
                            "currency": {
                              "type": "string",
                              "pattern": "^[A-Z]{3}$"
                            }
                          },
                          "required": [
                            "totalMinor",
                            "balanceMinor",
                            "currency"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "data",
                    "nextCursor",
                    "total"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      },
      "post": {
        "operationId": "createInvoiceDraft",
        "summary": "Creates a draft invoice for a customer.",
        "description": "Creates a draft invoice for a customer. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "entityId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "customerId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "issueDate": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  },
                  "dueDate": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  },
                  "currency": {
                    "type": "string",
                    "pattern": "^[A-Z]{3}$"
                  },
                  "receivableAccountId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "memo": {
                    "type": "string",
                    "maxLength": 500
                  },
                  "reference": {
                    "type": "string",
                    "maxLength": 120
                  },
                  "shipToAddressId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "lines": {
                    "$ref": "#/components/schemas/Lines5"
                  },
                  "customFields": {
                    "$ref": "#/components/schemas/CustomFields"
                  },
                  "contractId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "departmentValueId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "internalNote": {
                    "type": "string",
                    "maxLength": 2000
                  },
                  "supersedesInvoiceId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "contractBillingBasis": {
                    "type": "string",
                    "enum": [
                      "SCHEDULE",
                      "AMOUNT",
                      "PERCENT",
                      "LINES",
                      "MILESTONE",
                      "PERCENT_COMPLETE",
                      "HOLDBACK_RELEASE"
                    ]
                  },
                  "contractMilestoneId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "percentCompleteBp": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 10000
                  }
                },
                "required": [
                  "entityId",
                  "customerId",
                  "issueDate",
                  "lines"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "Ledger-Position": {
                "$ref": "#/components/headers/LedgerPosition"
              },
              "Location": {
                "$ref": "#/components/headers/Location"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetInvoiceResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem400"
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "409": {
            "$ref": "#/components/responses/Problem409"
          },
          "412": {
            "$ref": "#/components/responses/Problem412"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/receivables/invoices/import": {
      "post": {
        "operationId": "importInvoices",
        "summary": "Starts importing invoices from a file into the receivables, as a job you follow.",
        "description": "Starts importing invoices from a file into the receivables, as a job you follow. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "entityId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "source": {
                    "type": "string",
                    "enum": [
                      "CSV",
                      "API",
                      "ISSUED"
                    ]
                  },
                  "receivableAccountId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "rows": {
                    "minItems": 1,
                    "maxItems": 500,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "externalId": {
                          "type": "string",
                          "maxLength": 120
                        },
                        "number": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 60
                        },
                        "customer": {
                          "type": "object",
                          "properties": {
                            "name": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 200
                            },
                            "legalName": {
                              "type": "string",
                              "maxLength": 200
                            },
                            "country": {
                              "default": "CA",
                              "type": "string",
                              "pattern": "^[A-Z]{2}$"
                            },
                            "region": {
                              "type": "string",
                              "pattern": "^(CA|US)-[A-Z]{2}$"
                            },
                            "email": {
                              "type": "string",
                              "maxLength": 200
                            }
                          },
                          "required": [
                            "name"
                          ],
                          "additionalProperties": false
                        },
                        "issueDate": {
                          "type": "string",
                          "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                        },
                        "dueDate": {
                          "type": "string",
                          "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                        },
                        "currency": {
                          "type": "string",
                          "pattern": "^[A-Z]{3}$"
                        },
                        "lines": {
                          "minItems": 1,
                          "maxItems": 100,
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "description": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 500
                              },
                              "accountId": {
                                "type": "string",
                                "minLength": 1
                              },
                              "accountCode": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 20
                              },
                              "netMinor": {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              "supplyCategory": {
                                "default": "SERVICES",
                                "type": "string",
                                "enum": [
                                  "GOODS",
                                  "SERVICES",
                                  "INTANGIBLE_PROPERTY",
                                  "REAL_PROPERTY"
                                ]
                              },
                              "treatmentHint": {
                                "type": "string",
                                "enum": [
                                  "STANDARD",
                                  "ZERO_RATED",
                                  "EXEMPT",
                                  "OUT_OF_SCOPE"
                                ]
                              },
                              "dimensions": {
                                "$ref": "#/components/schemas/Dimensions2"
                              },
                              "customFields": {
                                "type": "object",
                                "propertyNames": {
                                  "type": "string",
                                  "pattern": "^[a-z][a-z0-9_]{0,39}$"
                                },
                                "additionalProperties": {
                                  "anyOf": [
                                    {
                                      "type": "string",
                                      "maxLength": 500
                                    },
                                    {
                                      "type": "boolean"
                                    }
                                  ]
                                }
                              }
                            },
                            "required": [
                              "description",
                              "netMinor"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "taxMinor": {
                          "type": "string",
                          "pattern": "^-?\\d+$"
                        },
                        "totalMinor": {
                          "type": "string",
                          "pattern": "^-?\\d+$"
                        },
                        "memo": {
                          "type": "string",
                          "maxLength": 500
                        },
                        "payment": {
                          "type": "object",
                          "properties": {
                            "paidOn": {
                              "type": "string",
                              "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                            },
                            "amountMinor": {
                              "type": "string",
                              "pattern": "^-?\\d+$"
                            },
                            "reference": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 120
                            },
                            "method": {
                              "type": "string",
                              "enum": [
                                "EFT",
                                "CHEQUE",
                                "CARD",
                                "CASH",
                                "OTHER",
                                "PAD",
                                "WIRE",
                                "DIRECT_DEPOSIT",
                                "ETRANSFER"
                              ]
                            }
                          },
                          "required": [
                            "paidOn",
                            "amountMinor",
                            "reference",
                            "method"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "required": [
                        "number",
                        "customer",
                        "issueDate",
                        "lines",
                        "taxMinor",
                        "totalMinor"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "defaultCurrency": {
                    "type": "string",
                    "pattern": "^[A-Z]{3}$"
                  }
                },
                "required": [
                  "entityId",
                  "source",
                  "receivableAccountId",
                  "rows"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Accepted: the work is done after the answer, or waits for a person's confirmation.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "Ledger-Position": {
                "$ref": "#/components/headers/LedgerPosition"
              },
              "Location": {
                "$ref": "#/components/headers/Location"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UndoAgentBatchResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem400"
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "409": {
            "$ref": "#/components/responses/Problem409"
          },
          "412": {
            "$ref": "#/components/responses/Problem412"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/receivables/invoices/{invoiceId}": {
      "get": {
        "operationId": "getInvoice",
        "summary": "Returns one invoice with its lines, status and payments.",
        "description": "Returns one invoice with its lines, status and payments. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "invoiceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetInvoiceResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "404": {
            "$ref": "#/components/responses/Problem404"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      },
      "patch": {
        "operationId": "updateInvoiceDraft",
        "summary": "Changes a draft invoice.",
        "description": "Changes a draft invoice. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "invoiceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "customerId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "issueDate": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  },
                  "dueDate": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  },
                  "currency": {
                    "type": "string",
                    "pattern": "^[A-Z]{3}$"
                  },
                  "receivableAccountId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "memo": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 500
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "reference": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 120
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "shipToAddressId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "lines": {
                    "$ref": "#/components/schemas/Lines5"
                  },
                  "customFields": {
                    "$ref": "#/components/schemas/CustomFields6"
                  },
                  "contractId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "departmentValueId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "internalNote": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 2000
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "contractBillingBasis": {
                    "anyOf": [
                      {
                        "type": "string",
                        "enum": [
                          "SCHEDULE",
                          "AMOUNT",
                          "PERCENT",
                          "LINES",
                          "MILESTONE",
                          "PERCENT_COMPLETE",
                          "HOLDBACK_RELEASE"
                        ]
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "contractMilestoneId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "percentCompleteBp": {
                    "anyOf": [
                      {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 10000
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "Ledger-Position": {
                "$ref": "#/components/headers/LedgerPosition"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetInvoiceResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem400"
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "404": {
            "$ref": "#/components/responses/Problem404"
          },
          "409": {
            "$ref": "#/components/responses/Problem409"
          },
          "412": {
            "$ref": "#/components/responses/Problem412"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      },
      "delete": {
        "operationId": "discardInvoiceDraft",
        "summary": "Discards a draft invoice that has not been issued.",
        "description": "Discards a draft invoice that has not been issued. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "invoiceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "Ledger-Position": {
                "$ref": "#/components/headers/LedgerPosition"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "number": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "id",
                    "number"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem400"
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "404": {
            "$ref": "#/components/responses/Problem404"
          },
          "409": {
            "$ref": "#/components/responses/Problem409"
          },
          "412": {
            "$ref": "#/components/responses/Problem412"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/receivables/invoices/{invoiceId}/approve": {
      "post": {
        "operationId": "approveInvoice",
        "summary": "Approves an invoice so that it can be issued.",
        "description": "Approves an invoice so that it can be issued. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:approve",
        "parameters": [
          {
            "name": "invoiceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SubmitInvoiceRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "Ledger-Position": {
                "$ref": "#/components/headers/LedgerPosition"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetInvoiceResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem400"
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "404": {
            "$ref": "#/components/responses/Problem404"
          },
          "409": {
            "$ref": "#/components/responses/Problem409"
          },
          "412": {
            "$ref": "#/components/responses/Problem412"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/receivables/invoices/{invoiceId}/audit": {
      "get": {
        "operationId": "listInvoiceAudit",
        "summary": "Lists the audit trail of one invoice.",
        "description": "Lists the audit trail of one invoice. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "invoiceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "action",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "receiptId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 512
            }
          },
          {
            "name": "origin",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "ALL",
                "NATIVE",
                "IMPORTED"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AuditLogResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "404": {
            "$ref": "#/components/responses/Problem404"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/receivables/invoices/{invoiceId}/collection": {
      "post": {
        "operationId": "noteInvoiceCollection",
        "summary": "Records a collection note on an invoice.",
        "description": "Records a collection note on an invoice. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "invoiceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "promisedToPayOn": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "note": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 500
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "Ledger-Position": {
                "$ref": "#/components/headers/LedgerPosition"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetInvoiceResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem400"
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "404": {
            "$ref": "#/components/responses/Problem404"
          },
          "409": {
            "$ref": "#/components/responses/Problem409"
          },
          "412": {
            "$ref": "#/components/responses/Problem412"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/receivables/invoices/{invoiceId}/copy": {
      "post": {
        "operationId": "copyInvoice",
        "summary": "Copies an invoice into a new draft.",
        "description": "Copies an invoice into a new draft. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "invoiceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "issueDate": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "Ledger-Position": {
                "$ref": "#/components/headers/LedgerPosition"
              },
              "Location": {
                "$ref": "#/components/headers/Location"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetInvoiceResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem400"
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "404": {
            "$ref": "#/components/responses/Problem404"
          },
          "409": {
            "$ref": "#/components/responses/Problem409"
          },
          "412": {
            "$ref": "#/components/responses/Problem412"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/receivables/invoices/{invoiceId}/deferral": {
      "get": {
        "operationId": "getInvoiceDeferral",
        "summary": "Returns the revenue deferral on an invoice.",
        "description": "Returns the revenue deferral on an invoice. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "invoiceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "invoiceId": {
                      "type": "string"
                    },
                    "number": {
                      "type": "string"
                    },
                    "currency": {
                      "type": "string",
                      "minLength": 3,
                      "maxLength": 3
                    },
                    "lines": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "lineId": {
                            "type": "string"
                          },
                          "position": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "description": {
                            "type": "string"
                          },
                          "deferredAccount": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "code": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "id",
                              "code",
                              "name"
                            ],
                            "additionalProperties": false
                          },
                          "revenueAccount": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "code": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "id",
                              "code",
                              "name"
                            ],
                            "additionalProperties": false
                          },
                          "netMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "servicePeriodStart": {
                            "anyOf": [
                              {
                                "type": "string",
                                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "servicePeriodEnd": {
                            "anyOf": [
                              {
                                "type": "string",
                                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "earnedLater": {
                            "type": "string",
                            "enum": [
                              "OVER_PERIOD_BY_MONTH",
                              "OVER_PERIOD_BY_DAY",
                              "ON_DATE",
                              "WHEN_RECOGNISED",
                              "BY_MILESTONE"
                            ]
                          },
                          "earnOn": {
                            "anyOf": [
                              {
                                "type": "string",
                                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "milestone": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "name": {
                                    "type": "string"
                                  },
                                  "percentBp": {
                                    "type": "integer",
                                    "minimum": 1,
                                    "maximum": 10000
                                  },
                                  "reachedOn": {
                                    "anyOf": [
                                      {
                                        "type": "string",
                                        "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ]
                                  },
                                  "contractId": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "id",
                                  "name",
                                  "percentBp",
                                  "reachedOn",
                                  "contractId"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "heldMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "rows": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": "string"
                                },
                                "position": {
                                  "type": "integer",
                                  "minimum": 0,
                                  "maximum": 9007199254740991
                                },
                                "periodStart": {
                                  "type": "string",
                                  "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                                },
                                "amountMinor": {
                                  "type": "string",
                                  "pattern": "^-?\\d+$"
                                },
                                "status": {
                                  "type": "string",
                                  "enum": [
                                    "SCHEDULED",
                                    "PROPOSED",
                                    "POSTED",
                                    "VOID"
                                  ]
                                },
                                "entryId": {
                                  "type": [
                                    "string",
                                    "null"
                                  ]
                                },
                                "entryNumber": {
                                  "type": [
                                    "string",
                                    "null"
                                  ]
                                },
                                "proposalId": {
                                  "type": [
                                    "string",
                                    "null"
                                  ]
                                }
                              },
                              "required": [
                                "id",
                                "position",
                                "periodStart",
                                "amountMinor",
                                "status",
                                "entryId",
                                "entryNumber",
                                "proposalId"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "releasedMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "proposedMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "scheduledMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "voidedMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          }
                        },
                        "required": [
                          "lineId",
                          "position",
                          "description",
                          "deferredAccount",
                          "revenueAccount",
                          "netMinor",
                          "servicePeriodStart",
                          "servicePeriodEnd",
                          "earnedLater",
                          "earnOn",
                          "milestone",
                          "heldMinor",
                          "rows",
                          "releasedMinor",
                          "proposedMinor",
                          "scheduledMinor",
                          "voidedMinor"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "totalDeferredMinor": {
                      "type": "string",
                      "pattern": "^-?\\d+$"
                    },
                    "releasedMinor": {
                      "type": "string",
                      "pattern": "^-?\\d+$"
                    },
                    "remainingMinor": {
                      "type": "string",
                      "pattern": "^-?\\d+$"
                    },
                    "identityHolds": {
                      "type": "boolean"
                    },
                    "identityNotes": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  },
                  "required": [
                    "invoiceId",
                    "number",
                    "currency",
                    "lines",
                    "totalDeferredMinor",
                    "releasedMinor",
                    "remainingMinor",
                    "identityHolds",
                    "identityNotes"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "404": {
            "$ref": "#/components/responses/Problem404"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/receivables/invoices/{invoiceId}/deliveries/manual": {
      "post": {
        "operationId": "markInvoiceSent",
        "summary": "Records that an invoice was sent outside the product.",
        "description": "Records that an invoice was sent outside the product. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:approve",
        "parameters": [
          {
            "name": "invoiceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "method": {
                    "type": "string",
                    "enum": [
                      "MANUAL",
                      "PORTAL"
                    ]
                  },
                  "channel": {
                    "type": "string",
                    "enum": [
                      "POST",
                      "HAND",
                      "OTHER_SYSTEM"
                    ]
                  },
                  "portal": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 80
                  },
                  "reference": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 120
                  },
                  "recipient": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "note": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 500
                  },
                  "sentOn": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  }
                },
                "required": [
                  "sentOn"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "Ledger-Position": {
                "$ref": "#/components/headers/LedgerPosition"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetInvoiceSendingResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem400"
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "404": {
            "$ref": "#/components/responses/Problem404"
          },
          "409": {
            "$ref": "#/components/responses/Problem409"
          },
          "412": {
            "$ref": "#/components/responses/Problem412"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/receivables/invoices/{invoiceId}/desk": {
      "post": {
        "operationId": "reassignInvoiceDesk",
        "summary": "Moves an invoice to another approval desk.",
        "description": "Moves an invoice to another approval desk. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:approve",
        "parameters": [
          {
            "name": "invoiceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "toUserId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "reason": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 500
                  }
                },
                "required": [
                  "toUserId",
                  "reason"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "Ledger-Position": {
                "$ref": "#/components/headers/LedgerPosition"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetInvoiceResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem400"
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "404": {
            "$ref": "#/components/responses/Problem404"
          },
          "409": {
            "$ref": "#/components/responses/Problem409"
          },
          "412": {
            "$ref": "#/components/responses/Problem412"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/receivables/invoices/{invoiceId}/edit": {
      "post": {
        "operationId": "proposeInvoiceEdit",
        "summary": "Proposes an edit to an issued invoice, for a person to decide.",
        "description": "Proposes an edit to an issued invoice, for a person to decide. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "invoiceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "dueDate": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  },
                  "memo": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 500
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "reference": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 120
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "shipToAddressId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "recipientPlace": {
                    "$ref": "#/components/schemas/RecipientPlace"
                  },
                  "lines": {
                    "$ref": "#/components/schemas/Lines5"
                  },
                  "reason": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 500
                  }
                },
                "required": [
                  "lines",
                  "reason"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "Ledger-Position": {
                "$ref": "#/components/headers/LedgerPosition"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetInvoiceResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem400"
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "404": {
            "$ref": "#/components/responses/Problem404"
          },
          "409": {
            "$ref": "#/components/responses/Problem409"
          },
          "412": {
            "$ref": "#/components/responses/Problem412"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/receivables/invoices/{invoiceId}/edit/decide": {
      "post": {
        "operationId": "decideInvoiceEdit",
        "summary": "Accepts or declines a proposed edit to an invoice.",
        "description": "Accepts or declines a proposed edit to an invoice. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:approve",
        "parameters": [
          {
            "name": "invoiceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "outcome": {
                    "type": "string",
                    "enum": [
                      "APPROVE",
                      "DECLINE"
                    ]
                  },
                  "reason": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 500
                  }
                },
                "required": [
                  "outcome",
                  "reason"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "Ledger-Position": {
                "$ref": "#/components/headers/LedgerPosition"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetInvoiceResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem400"
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "404": {
            "$ref": "#/components/responses/Problem404"
          },
          "409": {
            "$ref": "#/components/responses/Problem409"
          },
          "412": {
            "$ref": "#/components/responses/Problem412"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/receivables/invoices/{invoiceId}/entry-sides": {
      "get": {
        "operationId": "getInvoiceEntrySides",
        "summary": "Returns the two sides of the journal entry an invoice posts.",
        "description": "Returns the two sides of the journal entry an invoice posts. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "invoiceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "invoiceId": {
                      "type": "string"
                    },
                    "invoiceNumber": {
                      "type": "string"
                    },
                    "state": {
                      "type": "string",
                      "enum": [
                        "POSTED",
                        "PROPOSED"
                      ]
                    },
                    "currency": {
                      "type": "string",
                      "pattern": "^[A-Z]{3}$"
                    },
                    "entry": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string"
                            },
                            "number": {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            }
                          },
                          "required": [
                            "id",
                            "number"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "sides": {
                      "minItems": 2,
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "side": {
                            "type": "string",
                            "enum": [
                              "DR",
                              "CR"
                            ]
                          },
                          "role": {
                            "type": "string",
                            "enum": [
                              "RECEIVABLE",
                              "REVENUE",
                              "TAX",
                              "HOLDBACK",
                              "FREIGHT",
                              "OTHER"
                            ]
                          },
                          "accountId": {
                            "type": "string"
                          },
                          "accountCode": {
                            "type": "string"
                          },
                          "accountName": {
                            "type": "string"
                          },
                          "amountMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "label": {
                            "type": "string"
                          },
                          "row": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "minimum": 1,
                                "maximum": 9007199254740991
                              },
                              {
                                "type": "null"
                              }
                            ]
                          }
                        },
                        "required": [
                          "side",
                          "role",
                          "accountId",
                          "accountCode",
                          "accountName",
                          "amountMinor",
                          "label",
                          "row"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "debitMinor": {
                      "type": "string",
                      "pattern": "^-?\\d+$"
                    },
                    "creditMinor": {
                      "type": "string",
                      "pattern": "^-?\\d+$"
                    },
                    "caption": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "sentence": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "invoiceId",
                    "invoiceNumber",
                    "state",
                    "currency",
                    "entry",
                    "sides",
                    "debitMinor",
                    "creditMinor",
                    "caption",
                    "sentence"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "404": {
            "$ref": "#/components/responses/Problem404"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/receivables/invoices/{invoiceId}/internal-note": {
      "put": {
        "operationId": "setInvoiceInternalNote",
        "summary": "Sets the internal note on an invoice, which the customer does not see.",
        "description": "Sets the internal note on an invoice, which the customer does not see. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "invoiceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "note": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 2000
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "note"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "Ledger-Position": {
                "$ref": "#/components/headers/LedgerPosition"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetInvoiceResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem400"
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "404": {
            "$ref": "#/components/responses/Problem404"
          },
          "409": {
            "$ref": "#/components/responses/Problem409"
          },
          "412": {
            "$ref": "#/components/responses/Problem412"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/receivables/invoices/{invoiceId}/lines/{lineId}/recognise": {
      "post": {
        "operationId": "recogniseInvoiceLineRevenue",
        "summary": "Proposes recognising the revenue of one invoice line.",
        "description": "Proposes recognising the revenue of one invoice line. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "invoiceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "lineId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "recogniseOn": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  },
                  "amountMinor": {
                    "type": "string",
                    "pattern": "^-?\\d+$"
                  },
                  "note": {
                    "type": "string",
                    "maxLength": 500
                  }
                },
                "required": [
                  "recogniseOn",
                  "amountMinor"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "Ledger-Position": {
                "$ref": "#/components/headers/LedgerPosition"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "proposalId": {
                      "type": "string"
                    },
                    "invoiceId": {
                      "type": "string"
                    },
                    "lineId": {
                      "type": "string"
                    },
                    "recogniseOn": {
                      "type": "string",
                      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                    },
                    "amountMinor": {
                      "type": "string",
                      "pattern": "^-?\\d+$"
                    },
                    "remainingDeferredMinor": {
                      "type": "string",
                      "pattern": "^-?\\d+$"
                    }
                  },
                  "required": [
                    "proposalId",
                    "invoiceId",
                    "lineId",
                    "recogniseOn",
                    "amountMinor",
                    "remainingDeferredMinor"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem400"
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "404": {
            "$ref": "#/components/responses/Problem404"
          },
          "409": {
            "$ref": "#/components/responses/Problem409"
          },
          "412": {
            "$ref": "#/components/responses/Problem412"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/receivables/invoices/{invoiceId}/send": {
      "post": {
        "operationId": "sendInvoice",
        "summary": "Sends an invoice to the customer.",
        "description": "Sends an invoice to the customer. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "invoiceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {},
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "Ledger-Position": {
                "$ref": "#/components/headers/LedgerPosition"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SendCustomerStatementResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem400"
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "404": {
            "$ref": "#/components/responses/Problem404"
          },
          "409": {
            "$ref": "#/components/responses/Problem409"
          },
          "412": {
            "$ref": "#/components/responses/Problem412"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/receivables/invoices/{invoiceId}/send/decide": {
      "post": {
        "operationId": "decideInvoiceSend",
        "summary": "Approves or declines sending an invoice.",
        "description": "Approves or declines sending an invoice. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:approve",
        "parameters": [
          {
            "name": "invoiceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "decision": {
                    "type": "string",
                    "enum": [
                      "APPROVE",
                      "DECLINE"
                    ]
                  },
                  "reason": {
                    "type": "string",
                    "maxLength": 500
                  }
                },
                "required": [
                  "decision"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "Ledger-Position": {
                "$ref": "#/components/headers/LedgerPosition"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SendCustomerStatementResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem400"
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "404": {
            "$ref": "#/components/responses/Problem404"
          },
          "409": {
            "$ref": "#/components/responses/Problem409"
          },
          "412": {
            "$ref": "#/components/responses/Problem412"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/receivables/invoices/{invoiceId}/sending": {
      "get": {
        "operationId": "getInvoiceSending",
        "summary": "Returns the sending record of an invoice.",
        "description": "Returns the sending record of an invoice. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "invoiceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetInvoiceSendingResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "404": {
            "$ref": "#/components/responses/Problem404"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/receivables/invoices/{invoiceId}/submit": {
      "post": {
        "operationId": "submitInvoice",
        "summary": "Submits an invoice for approval before it is issued.",
        "description": "Submits an invoice for approval before it is issued. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "invoiceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SubmitInvoiceRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "Ledger-Position": {
                "$ref": "#/components/headers/LedgerPosition"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetInvoiceResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem400"
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "404": {
            "$ref": "#/components/responses/Problem404"
          },
          "409": {
            "$ref": "#/components/responses/Problem409"
          },
          "412": {
            "$ref": "#/components/responses/Problem412"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/receivables/invoices/{invoiceId}/versions": {
      "get": {
        "operationId": "listInvoiceVersions",
        "summary": "Lists the earlier versions of an invoice.",
        "description": "Lists the earlier versions of an invoice. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "invoiceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 512
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "number": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 9007199254740991
                          },
                          "kind": {
                            "type": "string",
                            "enum": [
                              "SUBMITTED",
                              "APPROVED",
                              "EDITED"
                            ]
                          },
                          "reason": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "createdBy": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "id",
                              "name"
                            ],
                            "additionalProperties": false
                          },
                          "createdAt": {
                            "type": "string",
                            "minLength": 20
                          },
                          "totalMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "currency": {
                            "type": "string",
                            "pattern": "^[A-Z]{3}$"
                          },
                          "diff": {
                            "$ref": "#/components/schemas/Diff"
                          },
                          "batch": {
                            "$ref": "#/components/schemas/Batch"
                          }
                        },
                        "required": [
                          "number",
                          "kind",
                          "reason",
                          "createdBy",
                          "createdAt",
                          "totalMinor",
                          "currency",
                          "diff"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "total": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "data",
                    "nextCursor",
                    "total"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "404": {
            "$ref": "#/components/responses/Problem404"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/receivables/invoices/{invoiceId}/versions/{number}": {
      "get": {
        "operationId": "getInvoiceVersion",
        "summary": "Returns one earlier version of an invoice.",
        "description": "Returns one earlier version of an invoice. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "invoiceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "number",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "number": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 9007199254740991
                    },
                    "kind": {
                      "type": "string",
                      "enum": [
                        "SUBMITTED",
                        "APPROVED",
                        "EDITED"
                      ]
                    },
                    "reason": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "createdBy": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "id",
                        "name"
                      ],
                      "additionalProperties": false
                    },
                    "createdAt": {
                      "type": "string",
                      "minLength": 20
                    },
                    "totalMinor": {
                      "type": "string",
                      "pattern": "^-?\\d+$"
                    },
                    "currency": {
                      "type": "string",
                      "pattern": "^[A-Z]{3}$"
                    },
                    "diff": {
                      "$ref": "#/components/schemas/Diff"
                    },
                    "batch": {
                      "$ref": "#/components/schemas/Batch"
                    },
                    "snapshot": {
                      "type": "object",
                      "properties": {
                        "number": {
                          "type": "string"
                        },
                        "status": {
                          "type": "string",
                          "enum": [
                            "DRAFT",
                            "APPROVED",
                            "PARTIALLY_PAID",
                            "PAID",
                            "VOID",
                            "WRITTEN_OFF"
                          ]
                        },
                        "customer": {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string"
                            },
                            "displayName": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "id",
                            "displayName"
                          ],
                          "additionalProperties": false
                        },
                        "entityId": {
                          "type": "string"
                        },
                        "entityName": {
                          "type": "string"
                        },
                        "issueDate": {
                          "type": "string",
                          "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                        },
                        "dueDate": {
                          "type": "string",
                          "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                        },
                        "currency": {
                          "type": "string",
                          "pattern": "^[A-Z]{3}$"
                        },
                        "subtotalMinor": {
                          "type": "string",
                          "pattern": "^-?\\d+$"
                        },
                        "taxMinor": {
                          "type": "string",
                          "pattern": "^-?\\d+$"
                        },
                        "totalMinor": {
                          "type": "string",
                          "pattern": "^-?\\d+$"
                        },
                        "memo": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "reference": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "language": {
                          "anyOf": [
                            {
                              "type": "string",
                              "enum": [
                                "en",
                                "fr"
                              ]
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "documentLabels": {
                          "anyOf": [
                            {
                              "type": "object",
                              "propertyNames": {
                                "type": "string"
                              },
                              "additionalProperties": {
                                "type": "string"
                              }
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "entryId": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "lines": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "position": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              },
                              "description": {
                                "type": "string"
                              },
                              "account": {
                                "$ref": "#/components/schemas/Account"
                              },
                              "quantity": {
                                "type": "string"
                              },
                              "unitPriceMinor": {
                                "anyOf": [
                                  {
                                    "type": "string",
                                    "pattern": "^-?\\d+$"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "netMinor": {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              "taxMinor": {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              "supplyCategory": {
                                "type": "string",
                                "enum": [
                                  "GOODS",
                                  "SERVICES",
                                  "INTANGIBLE_PROPERTY",
                                  "REAL_PROPERTY"
                                ]
                              },
                              "treatmentHint": {
                                "anyOf": [
                                  {
                                    "type": "string",
                                    "enum": [
                                      "STANDARD",
                                      "ZERO_RATED",
                                      "EXEMPT",
                                      "OUT_OF_SCOPE",
                                      "RELIEVED"
                                    ]
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "product": {
                                "$ref": "#/components/schemas/Account"
                              },
                              "dimensions": {
                                "$ref": "#/components/schemas/Dimensions3"
                              }
                            },
                            "required": [
                              "position",
                              "description",
                              "account",
                              "quantity",
                              "unitPriceMinor",
                              "netMinor",
                              "taxMinor",
                              "supplyCategory",
                              "treatmentHint",
                              "product",
                              "dimensions"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "shipTo": {
                          "anyOf": [
                            {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "placeOfSupply": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "country": {
                                  "type": "string"
                                },
                                "region": {
                                  "type": [
                                    "string",
                                    "null"
                                  ]
                                }
                              },
                              "required": [
                                "country",
                                "region"
                              ],
                              "additionalProperties": false
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "recipientPlace": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "country": {
                                  "type": "string"
                                },
                                "region": {
                                  "type": [
                                    "string",
                                    "null"
                                  ]
                                }
                              },
                              "required": [
                                "country",
                                "region"
                              ],
                              "additionalProperties": false
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      },
                      "required": [
                        "number",
                        "status",
                        "customer",
                        "entityId",
                        "entityName",
                        "issueDate",
                        "dueDate",
                        "currency",
                        "subtotalMinor",
                        "taxMinor",
                        "totalMinor",
                        "memo",
                        "reference",
                        "language",
                        "documentLabels",
                        "entryId",
                        "lines"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "number",
                    "kind",
                    "reason",
                    "createdBy",
                    "createdAt",
                    "totalMinor",
                    "currency",
                    "diff",
                    "snapshot"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "404": {
            "$ref": "#/components/responses/Problem404"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/receivables/invoices/{invoiceId}/void": {
      "post": {
        "operationId": "voidInvoice",
        "summary": "Voids an invoice, reversing its posting.",
        "description": "Voids an invoice, reversing its posting. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:approve",
        "parameters": [
          {
            "name": "invoiceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "reason": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 500
                  }
                },
                "required": [
                  "reason"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "Ledger-Position": {
                "$ref": "#/components/headers/LedgerPosition"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetInvoiceResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem400"
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "404": {
            "$ref": "#/components/responses/Problem404"
          },
          "409": {
            "$ref": "#/components/responses/Problem409"
          },
          "412": {
            "$ref": "#/components/responses/Problem412"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/receivables/invoices/{invoiceId}/void-and-reissue": {
      "post": {
        "operationId": "voidAndReissueInvoice",
        "summary": "Voids an invoice and issues a corrected one in its place.",
        "description": "Voids an invoice and issues a corrected one in its place. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:approve",
        "parameters": [
          {
            "name": "invoiceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "reason": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 500
                  }
                },
                "required": [
                  "reason"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "Ledger-Position": {
                "$ref": "#/components/headers/LedgerPosition"
              },
              "Location": {
                "$ref": "#/components/headers/Location"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetInvoiceResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem400"
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "404": {
            "$ref": "#/components/responses/Problem404"
          },
          "409": {
            "$ref": "#/components/responses/Problem409"
          },
          "412": {
            "$ref": "#/components/responses/Problem412"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/receivables/invoices/{invoiceId}/write-off": {
      "post": {
        "operationId": "proposeInvoiceWriteOff",
        "summary": "Proposes writing off an invoice for a person to decide.",
        "description": "Proposes writing off an invoice for a person to decide. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "invoiceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "amountMinor": {
                    "type": "string",
                    "pattern": "^-?\\d+$"
                  },
                  "reason": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 500
                  },
                  "armsLength": {
                    "default": true,
                    "type": "boolean"
                  },
                  "armsLengthReason": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 500
                  }
                },
                "required": [
                  "amountMinor",
                  "reason"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "Ledger-Position": {
                "$ref": "#/components/headers/LedgerPosition"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetInvoiceResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem400"
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "404": {
            "$ref": "#/components/responses/Problem404"
          },
          "409": {
            "$ref": "#/components/responses/Problem409"
          },
          "412": {
            "$ref": "#/components/responses/Problem412"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/receivables/invoices/{invoiceId}/write-off/decide": {
      "post": {
        "operationId": "decideInvoiceWriteOff",
        "summary": "Approves or declines a write-off of an invoice.",
        "description": "Approves or declines a write-off of an invoice. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:approve",
        "parameters": [
          {
            "name": "invoiceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "decision": {
                    "type": "string",
                    "enum": [
                      "APPROVE",
                      "DECLINE"
                    ]
                  },
                  "reason": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 500
                  }
                },
                "required": [
                  "decision"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "Ledger-Position": {
                "$ref": "#/components/headers/LedgerPosition"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetInvoiceResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem400"
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "404": {
            "$ref": "#/components/responses/Problem404"
          },
          "409": {
            "$ref": "#/components/responses/Problem409"
          },
          "412": {
            "$ref": "#/components/responses/Problem412"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/receivables/invoices/{invoiceId}/write-off/recover": {
      "post": {
        "operationId": "recoverInvoiceWriteOff",
        "summary": "Recovers an invoice that was written off.",
        "description": "Recovers an invoice that was written off. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:approve",
        "parameters": [
          {
            "name": "invoiceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "amountMinor": {
                    "type": "string",
                    "pattern": "^-?\\d+$"
                  },
                  "reason": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 500
                  }
                },
                "required": [
                  "amountMinor",
                  "reason"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "Ledger-Position": {
                "$ref": "#/components/headers/LedgerPosition"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetInvoiceResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem400"
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "404": {
            "$ref": "#/components/responses/Problem404"
          },
          "409": {
            "$ref": "#/components/responses/Problem409"
          },
          "412": {
            "$ref": "#/components/responses/Problem412"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/receivables/invoices/{invoiceId}/write-off/tax": {
      "get": {
        "operationId": "getInvoiceWriteOffTax",
        "summary": "Returns the tax that a write-off of an invoice would reverse.",
        "description": "Returns the tax that a write-off of an invoice would reverse. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "invoiceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "amountMinor",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^-?\\d+$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "taxOnSupplyMinor": {
                      "type": "string",
                      "pattern": "^-?\\d+$"
                    },
                    "writtenOffMinor": {
                      "type": "string",
                      "pattern": "^-?\\d+$"
                    },
                    "totalMinor": {
                      "type": "string",
                      "pattern": "^-?\\d+$"
                    },
                    "adjustmentMinor": {
                      "type": "string",
                      "pattern": "^-?\\d+$"
                    },
                    "registrationId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "formula": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "taxOnSupplyMinor",
                    "writtenOffMinor",
                    "totalMinor",
                    "adjustmentMinor",
                    "registrationId",
                    "formula"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "404": {
            "$ref": "#/components/responses/Problem404"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/receivables/number-series": {
      "get": {
        "operationId": "getInvoiceNumberSeries",
        "summary": "Returns the numbering series invoices are issued under.",
        "description": "Returns the numbering series invoices are issued under. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "entityId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetInvoiceNumberSeriesResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      },
      "patch": {
        "operationId": "updateInvoiceNumberSeries",
        "summary": "Changes the numbering series invoices are issued under.",
        "description": "Changes the numbering series invoices are issued under. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:approve",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "entityId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "prefix": {
                    "type": "string",
                    "maxLength": 12,
                    "pattern": "^[A-Za-z0-9./-]{0,12}$"
                  },
                  "padding": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 12
                  }
                },
                "required": [
                  "entityId"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "Ledger-Position": {
                "$ref": "#/components/headers/LedgerPosition"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetInvoiceNumberSeriesResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem400"
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "409": {
            "$ref": "#/components/responses/Problem409"
          },
          "412": {
            "$ref": "#/components/responses/Problem412"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/receivables/receipt-matches": {
      "get": {
        "operationId": "getReceiptMatches",
        "summary": "Returns the invoices a received payment may be matched to.",
        "description": "Returns the invoices a received payment may be matched to. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "entityId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "customerId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "amountMinor",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^-?\\d+$"
            }
          },
          {
            "name": "currency",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[A-Z]{3}$"
            }
          },
          {
            "name": "reference",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 120
            }
          },
          {
            "name": "bankLineId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "referenceOwner": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "customer": {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": "string"
                                },
                                "displayName": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "id",
                                "displayName"
                              ],
                              "additionalProperties": false
                            },
                            "invoice": {
                              "$ref": "#/components/schemas/Invoice3"
                            },
                            "switchTo": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "customer",
                            "invoice",
                            "switchTo"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "preTicked": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/PreTickedItem"
                      }
                    },
                    "closeMatches": {
                      "maxItems": 5,
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/PreTickedItem"
                      }
                    },
                    "candidates": {
                      "maxItems": 10,
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "customer": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "displayName": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "id",
                              "displayName"
                            ],
                            "additionalProperties": false
                          },
                          "invoices": {
                            "minItems": 1,
                            "type": "array",
                            "items": {
                              "$ref": "#/components/schemas/Invoice3"
                            }
                          },
                          "score": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 100
                          },
                          "signals": {
                            "minItems": 1,
                            "type": "array",
                            "items": {
                              "type": "string",
                              "enum": [
                                "REFERENCE",
                                "AMOUNT",
                                "CUSTOMER_NAME",
                                "INVOICE_SUM",
                                "OLDEST_FIRST"
                              ]
                            }
                          },
                          "sentence": {
                            "type": "string",
                            "minLength": 1
                          }
                        },
                        "required": [
                          "customer",
                          "invoices",
                          "score",
                          "signals",
                          "sentence"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "referenceOwner",
                    "preTicked",
                    "closeMatches",
                    "candidates"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/receivables/receipt-voids/waiting": {
      "get": {
        "operationId": "listReceiptVoidsWaiting",
        "summary": "Lists the receipt voids waiting for a second person to approve.",
        "description": "Lists the receipt voids waiting for a second person to approve. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "default": 10,
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 512
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "receiptId": {
                            "type": "string"
                          },
                          "customer": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "displayName": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "id",
                              "displayName"
                            ],
                            "additionalProperties": false
                          },
                          "entityName": {
                            "type": "string"
                          },
                          "amountMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "currency": {
                            "type": "string",
                            "pattern": "^[A-Z]{3}$"
                          },
                          "receivedOn": {
                            "type": "string",
                            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                          },
                          "reference": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "voidReason": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "voidedBy": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "name": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "id",
                                  "name"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "voidedAt": {
                            "type": "string",
                            "minLength": 20
                          },
                          "mirrorEntryId": {
                            "type": "string"
                          },
                          "caused": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "enum": [
                                    "DEPOSIT_TRANSFER",
                                    "EXCHANGE_DIFFERENCE"
                                  ]
                                },
                                "invoiceNumber": {
                                  "type": "string"
                                },
                                "entryId": {
                                  "type": "string"
                                },
                                "reversalEntryId": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "kind",
                                "invoiceNumber",
                                "entryId",
                                "reversalEntryId"
                              ],
                              "additionalProperties": false
                            }
                          }
                        },
                        "required": [
                          "receiptId",
                          "customer",
                          "entityName",
                          "amountMinor",
                          "currency",
                          "receivedOn",
                          "reference",
                          "voidReason",
                          "voidedBy",
                          "voidedAt",
                          "mirrorEntryId",
                          "caused"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "total": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "data",
                    "nextCursor",
                    "total"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/receivables/receipts": {
      "post": {
        "operationId": "recordReceipt",
        "summary": "Records a payment received from a customer.",
        "description": "Records a payment received from a customer. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "entityId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "customerId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "receivedOn": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  },
                  "amountMinor": {
                    "type": "string",
                    "pattern": "^-?\\d+$"
                  },
                  "currency": {
                    "type": "string",
                    "pattern": "^[A-Z]{3}$"
                  },
                  "method": {
                    "type": "string",
                    "enum": [
                      "EFT",
                      "CHEQUE",
                      "CARD",
                      "CASH",
                      "OTHER",
                      "PAD",
                      "WIRE",
                      "DIRECT_DEPOSIT",
                      "ETRANSFER"
                    ]
                  },
                  "reference": {
                    "type": "string",
                    "maxLength": 120
                  },
                  "financialAccountId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "sourceTransactionId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "receivableAccountId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "applications": {
                    "$ref": "#/components/schemas/Applications2"
                  },
                  "postImmediately": {
                    "default": false,
                    "type": "boolean"
                  },
                  "holdAsDeposit": {
                    "default": false,
                    "type": "boolean"
                  },
                  "processor": {
                    "type": "string",
                    "enum": [
                      "STRIPE",
                      "SHOPIFY",
                      "SQUARE"
                    ]
                  }
                },
                "required": [
                  "entityId",
                  "customerId",
                  "receivedOn",
                  "amountMinor",
                  "currency",
                  "method",
                  "financialAccountId"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "Ledger-Position": {
                "$ref": "#/components/headers/LedgerPosition"
              },
              "Location": {
                "$ref": "#/components/headers/Location"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RecordReceiptResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem400"
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "409": {
            "$ref": "#/components/responses/Problem409"
          },
          "412": {
            "$ref": "#/components/responses/Problem412"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      },
      "get": {
        "operationId": "listReceipts",
        "summary": "Lists the payments received from customers, with the server's total.",
        "description": "Lists the payments received from customers, with the server's total. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "entityId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "customerId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "receivedFrom",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
            }
          },
          {
            "name": "receivedTo",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
            }
          },
          {
            "name": "method",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            }
          },
          {
            "name": "processor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "STRIPE",
                "SHOPIFY",
                "SQUARE"
              ]
            }
          },
          {
            "name": "financialAccountId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "direction",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "IN",
                "OUT"
              ]
            }
          },
          {
            "name": "amountFromMinor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^-?\\d+$"
            }
          },
          {
            "name": "amountToMinor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^-?\\d+$"
            }
          },
          {
            "name": "currency",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^[A-Z]{3}$"
            }
          },
          {
            "name": "unapplied",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "any",
                "some",
                "none"
              ]
            }
          },
          {
            "name": "voided",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "yes",
                "no",
                "only"
              ]
            }
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 512
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/RecordReceiptResponse"
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "total": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "data",
                    "nextCursor",
                    "total"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/receivables/receipts/{receiptId}": {
      "get": {
        "operationId": "getReceipt",
        "summary": "Returns one received payment with its allocations.",
        "description": "Returns one received payment with its allocations. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "receiptId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RecordReceiptResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "404": {
            "$ref": "#/components/responses/Problem404"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/receivables/receipts/{receiptId}/apply": {
      "post": {
        "operationId": "applyReceipt",
        "summary": "Applies a received payment against open invoices.",
        "description": "Applies a received payment against open invoices. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "receiptId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "applications": {
                    "minItems": 1,
                    "maxItems": 200,
                    "type": "array",
                    "items": {
                      "$ref": "#/components/schemas/Applications2Item"
                    }
                  }
                },
                "required": [
                  "applications"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "Ledger-Position": {
                "$ref": "#/components/headers/LedgerPosition"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RecordReceiptResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem400"
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "404": {
            "$ref": "#/components/responses/Problem404"
          },
          "409": {
            "$ref": "#/components/responses/Problem409"
          },
          "412": {
            "$ref": "#/components/responses/Problem412"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/receivables/receipts/{receiptId}/correct": {
      "post": {
        "operationId": "correctReceipt",
        "summary": "Corrects a received payment that was recorded wrongly.",
        "description": "Corrects a received payment that was recorded wrongly. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "receiptId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "customerId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "reason": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 500
                  },
                  "applications": {
                    "$ref": "#/components/schemas/Applications2"
                  }
                },
                "required": [
                  "customerId",
                  "reason"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "Ledger-Position": {
                "$ref": "#/components/headers/LedgerPosition"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "voided": {
                      "$ref": "#/components/schemas/RecordReceiptResponse"
                    },
                    "recorded": {
                      "$ref": "#/components/schemas/RecordReceiptResponse"
                    }
                  },
                  "required": [
                    "voided",
                    "recorded"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem400"
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "404": {
            "$ref": "#/components/responses/Problem404"
          },
          "409": {
            "$ref": "#/components/responses/Problem409"
          },
          "412": {
            "$ref": "#/components/responses/Problem412"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/receivables/receipts/{receiptId}/void": {
      "post": {
        "operationId": "voidReceipt",
        "summary": "Requests the void of a received payment, which a second person approves.",
        "description": "Requests the void of a received payment, which a second person approves. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "receiptId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "reason": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 500
                  },
                  "postImmediately": {
                    "default": false,
                    "type": "boolean"
                  }
                },
                "required": [
                  "reason"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "Ledger-Position": {
                "$ref": "#/components/headers/LedgerPosition"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RecordReceiptResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem400"
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "404": {
            "$ref": "#/components/responses/Problem404"
          },
          "409": {
            "$ref": "#/components/responses/Problem409"
          },
          "412": {
            "$ref": "#/components/responses/Problem412"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/receivables/receipts/{receiptId}/void/approve": {
      "post": {
        "operationId": "approveReceiptVoid",
        "summary": "Approves the void of a received payment.",
        "description": "Approves the void of a received payment. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:approve",
        "parameters": [
          {
            "name": "receiptId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "Ledger-Position": {
                "$ref": "#/components/headers/LedgerPosition"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RecordReceiptResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem400"
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "404": {
            "$ref": "#/components/responses/Problem404"
          },
          "409": {
            "$ref": "#/components/responses/Problem409"
          },
          "412": {
            "$ref": "#/components/responses/Problem412"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/receivables/receipts/{receiptId}/void/decline": {
      "post": {
        "operationId": "declineReceiptVoid",
        "summary": "Declines the void of a received payment with a reason.",
        "description": "Declines the void of a received payment with a reason. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:approve",
        "parameters": [
          {
            "name": "receiptId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "reason": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 500
                  }
                },
                "required": [
                  "reason"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "Ledger-Position": {
                "$ref": "#/components/headers/LedgerPosition"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RecordReceiptResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem400"
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "404": {
            "$ref": "#/components/responses/Problem404"
          },
          "409": {
            "$ref": "#/components/responses/Problem409"
          },
          "412": {
            "$ref": "#/components/responses/Problem412"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/reminders/cards": {
      "get": {
        "operationId": "listReminderCards",
        "summary": "Lists the payment reminders waiting for a person to decide.",
        "description": "Lists the payment reminders waiting for a person to decide. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "entityId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "default": "PENDING",
              "type": "string",
              "enum": [
                "PENDING",
                "APPROVED",
                "REJECTED"
              ]
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 512
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "proposalId": {
                            "type": "string"
                          },
                          "entityId": {
                            "type": "string"
                          },
                          "entityName": {
                            "type": "string"
                          },
                          "date": {
                            "type": "string",
                            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                          },
                          "lineCount": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "reminderCount": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "statementCount": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "totalMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "currency": {
                            "type": "string",
                            "pattern": "^[A-Z]{3}$"
                          },
                          "proposedAt": {
                            "type": "string",
                            "minLength": 20
                          }
                        },
                        "required": [
                          "proposalId",
                          "entityId",
                          "entityName",
                          "date",
                          "lineCount",
                          "reminderCount",
                          "statementCount",
                          "totalMinor",
                          "currency",
                          "proposedAt"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "total": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "data",
                    "nextCursor",
                    "total"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/reminders/cards/{proposalId}": {
      "get": {
        "operationId": "getReminderCard",
        "summary": "Returns one payment reminder with the evidence it is built on.",
        "description": "Returns one payment reminder with the evidence it is built on. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "proposalId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "proposalId": {
                      "type": "string"
                    },
                    "entityId": {
                      "type": "string"
                    },
                    "entityName": {
                      "type": "string"
                    },
                    "date": {
                      "type": "string",
                      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "PENDING",
                        "APPROVED",
                        "REJECTED"
                      ]
                    },
                    "lines": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "key": {
                            "type": "string"
                          },
                          "kind": {
                            "type": "string",
                            "enum": [
                              "REMINDER",
                              "STATEMENT"
                            ]
                          },
                          "customerId": {
                            "type": "string"
                          },
                          "customerName": {
                            "type": "string"
                          },
                          "invoiceId": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "number": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "dueDate": {
                            "anyOf": [
                              {
                                "type": "string",
                                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "stepId": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "stepPosition": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "stepOffsetDays": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "escalates": {
                            "type": "boolean"
                          },
                          "balanceMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "currency": {
                            "type": "string",
                            "pattern": "^[A-Z]{3}$"
                          },
                          "language": {
                            "type": "string",
                            "enum": [
                              "en",
                              "fr"
                            ]
                          },
                          "recipients": {
                            "$ref": "#/components/schemas/Recipients2"
                          },
                          "preview": {
                            "$ref": "#/components/schemas/Preview"
                          }
                        },
                        "required": [
                          "key",
                          "kind",
                          "customerId",
                          "customerName",
                          "invoiceId",
                          "number",
                          "dueDate",
                          "stepId",
                          "stepPosition",
                          "stepOffsetDays",
                          "escalates",
                          "balanceMinor",
                          "currency",
                          "language",
                          "recipients",
                          "preview"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "escalationEmail": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "blocked": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "cap": {
                      "$ref": "#/components/schemas/Cap"
                    },
                    "breaker": {
                      "$ref": "#/components/schemas/Breaker"
                    },
                    "proposedAt": {
                      "type": "string",
                      "minLength": 20
                    },
                    "decision": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "sent": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "skipped": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "total": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            }
                          },
                          "required": [
                            "sent",
                            "skipped",
                            "total"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "proposalId",
                    "entityId",
                    "entityName",
                    "date",
                    "status",
                    "lines",
                    "escalationEmail",
                    "blocked",
                    "cap",
                    "breaker",
                    "proposedAt",
                    "decision"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "404": {
            "$ref": "#/components/responses/Problem404"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/reminders/cards/{proposalId}/decide": {
      "post": {
        "operationId": "decideReminderCard",
        "summary": "Approves or declines a payment reminder.",
        "description": "Approves or declines a payment reminder. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:approve",
        "parameters": [
          {
            "name": "proposalId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "decision": {
                    "type": "string",
                    "enum": [
                      "APPROVE",
                      "SEND_BACK"
                    ]
                  },
                  "lines": {
                    "maxItems": 2000,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1
                    }
                  },
                  "reason": {
                    "type": "string",
                    "maxLength": 500
                  }
                },
                "required": [
                  "decision"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "Ledger-Position": {
                "$ref": "#/components/headers/LedgerPosition"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "proposalId": {
                      "type": "string"
                    },
                    "outcome": {
                      "type": "string",
                      "enum": [
                        "SENT",
                        "PARTLY_SENT",
                        "NOTHING_SENT",
                        "SENT_BACK"
                      ]
                    },
                    "sent": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "refused": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "skipped": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "lines": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "key": {
                            "type": "string"
                          },
                          "customerName": {
                            "type": "string"
                          },
                          "number": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "outcome": {
                            "type": "string",
                            "enum": [
                              "SENT",
                              "PARTLY_SENT",
                              "FAILED",
                              "REFUSED",
                              "SKIPPED"
                            ]
                          },
                          "reason": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "recipients": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          }
                        },
                        "required": [
                          "key",
                          "customerName",
                          "number",
                          "outcome",
                          "reason",
                          "recipients"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "proposalId",
                    "outcome",
                    "sent",
                    "refused",
                    "skipped",
                    "lines"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem400"
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "404": {
            "$ref": "#/components/responses/Problem404"
          },
          "409": {
            "$ref": "#/components/responses/Problem409"
          },
          "412": {
            "$ref": "#/components/responses/Problem412"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/reminders/pauses": {
      "get": {
        "operationId": "listReminderPauses",
        "summary": "Lists the pauses on payment reminders.",
        "description": "Lists the pauses on payment reminders. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "entityId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "customerId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "invoiceId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "state",
            "in": "query",
            "required": false,
            "schema": {
              "default": "live",
              "type": "string",
              "enum": [
                "live",
                "all"
              ]
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 512
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ListReminderPausesResponseItem"
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "total": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "data",
                    "nextCursor",
                    "total"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      },
      "post": {
        "operationId": "pauseReminders",
        "summary": "Pauses payment reminders for a customer or a period.",
        "description": "Pauses payment reminders for a customer or a period. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "customerId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "invoiceId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "reason": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 500
                  }
                },
                "required": [
                  "reason"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "Ledger-Position": {
                "$ref": "#/components/headers/LedgerPosition"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListReminderPausesResponseItem"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem400"
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "409": {
            "$ref": "#/components/responses/Problem409"
          },
          "412": {
            "$ref": "#/components/responses/Problem412"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/reminders/pauses/{pauseId}/resume": {
      "post": {
        "operationId": "resumeReminders",
        "summary": "Resumes payment reminders that were paused.",
        "description": "Resumes payment reminders that were paused. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "pauseId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "reason": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 500
                  }
                },
                "required": [
                  "reason"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "Ledger-Position": {
                "$ref": "#/components/headers/LedgerPosition"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListReminderPausesResponseItem"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem400"
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "404": {
            "$ref": "#/components/responses/Problem404"
          },
          "409": {
            "$ref": "#/components/responses/Problem409"
          },
          "412": {
            "$ref": "#/components/responses/Problem412"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/reminders/settings": {
      "get": {
        "operationId": "getReminderSettings",
        "summary": "Returns the payment reminder settings of the ledger.",
        "description": "Returns the payment reminder settings of the ledger. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "entityId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetReminderSettingsResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      },
      "patch": {
        "operationId": "updateReminderSettings",
        "summary": "Changes the payment reminder settings of the ledger.",
        "description": "Changes the payment reminder settings of the ledger. Needs the `ledger:admin` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:admin",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "entityId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "steps": {
                    "maxItems": 12,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "offsetDays": {
                          "type": "integer",
                          "minimum": -365,
                          "maximum": 365
                        },
                        "en": {
                          "$ref": "#/components/schemas/Preview"
                        },
                        "fr": {
                          "$ref": "#/components/schemas/Preview"
                        },
                        "active": {
                          "default": true,
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "offsetDays",
                        "en",
                        "fr"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "escalationEmail": {
                    "type": "string",
                    "maxLength": 200
                  },
                  "monthlyStatements": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "entityId"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "Ledger-Position": {
                "$ref": "#/components/headers/LedgerPosition"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetReminderSettingsResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem400"
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "409": {
            "$ref": "#/components/responses/Problem409"
          },
          "412": {
            "$ref": "#/components/responses/Problem412"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/sales-settings": {
      "get": {
        "operationId": "getSalesSettings",
        "summary": "Returns the sales settings of the ledger.",
        "description": "Returns the sales settings of the ledger. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [],
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "customersNeedApproval": {
                      "type": "boolean"
                    },
                    "overLimitApprovals": {
                      "anyOf": [
                        {
                          "type": "number",
                          "const": 1
                        },
                        {
                          "type": "number",
                          "const": 2
                        }
                      ]
                    },
                    "updatedBy": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string"
                            },
                            "name": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "id",
                            "name"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "updatedAt": {
                      "anyOf": [
                        {
                          "type": "string",
                          "minLength": 20
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "customersNeedApproval",
                    "overLimitApprovals",
                    "updatedBy",
                    "updatedAt"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/sales/reports/{report}": {
      "get": {
        "operationId": "salesReport",
        "summary": "Returns one sales report for the period chosen.",
        "description": "Returns one sales report for the period chosen. Needs the `statements:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "statements:read",
        "parameters": [
          {
            "name": "report",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "entityId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "customerId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "productId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200,
              "pattern": "^[A-Za-z_][A-Za-z0-9_]*(\\s*,\\s*[A-Za-z_][A-Za-z0-9_]*)*,?$"
            }
          },
          {
            "name": "issuedFrom",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
            }
          },
          {
            "name": "issuedTo",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
            }
          },
          {
            "name": "currency",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^[A-Z]{3}$"
            }
          },
          {
            "name": "byFamily",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "yes"
              ]
            }
          },
          {
            "name": "taxCodeId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "region",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 16
            }
          },
          {
            "name": "grouping",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "month",
                "quarter",
                "year"
              ]
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 512
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "report": {
                      "type": "string",
                      "enum": [
                        "sales-by-customer",
                        "sales-by-item",
                        "delivered-not-billed",
                        "sales-by-month",
                        "tax-collected",
                        "invoice-register",
                        "ageing",
                        "sends",
                        "credit-memos",
                        "deferred-revenue"
                      ]
                    },
                    "title": {
                      "type": "string"
                    },
                    "description": {
                      "type": "string"
                    },
                    "currency": {
                      "anyOf": [
                        {
                          "type": "string",
                          "pattern": "^[A-Z]{3}$"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "asOf": {
                      "type": "string",
                      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                    },
                    "columns": {
                      "minItems": 1,
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "field": {
                            "type": "string"
                          },
                          "label": {
                            "type": "string"
                          },
                          "kind": {
                            "type": "string",
                            "enum": [
                              "text",
                              "ref",
                              "money",
                              "count",
                              "quantity",
                              "date",
                              "state"
                            ]
                          },
                          "total": {
                            "type": "boolean"
                          }
                        },
                        "required": [
                          "field",
                          "label",
                          "kind",
                          "total"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "rows": {
                      "type": "array",
                      "items": {
                        "oneOf": [
                          {
                            "type": "object",
                            "properties": {
                              "invoicedMinor": {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              "creditedMinor": {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              "netMinor": {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              "paidMinor": {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              "outstandingMinor": {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              "taxMinor": {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              "invoiceCount": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              },
                              "key": {
                                "type": "string"
                              },
                              "report": {
                                "type": "string",
                                "const": "sales-by-customer"
                              },
                              "customer": {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "label": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "id",
                                  "label"
                                ],
                                "additionalProperties": false
                              },
                              "members": {
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "invoicedMinor": {
                                      "type": "string",
                                      "pattern": "^-?\\d+$"
                                    },
                                    "creditedMinor": {
                                      "type": "string",
                                      "pattern": "^-?\\d+$"
                                    },
                                    "netMinor": {
                                      "type": "string",
                                      "pattern": "^-?\\d+$"
                                    },
                                    "paidMinor": {
                                      "type": "string",
                                      "pattern": "^-?\\d+$"
                                    },
                                    "outstandingMinor": {
                                      "type": "string",
                                      "pattern": "^-?\\d+$"
                                    },
                                    "taxMinor": {
                                      "type": "string",
                                      "pattern": "^-?\\d+$"
                                    },
                                    "invoiceCount": {
                                      "type": "integer",
                                      "minimum": 0,
                                      "maximum": 9007199254740991
                                    },
                                    "customer": {
                                      "type": "object",
                                      "properties": {
                                        "id": {
                                          "type": "string"
                                        },
                                        "label": {
                                          "type": "string"
                                        }
                                      },
                                      "required": [
                                        "id",
                                        "label"
                                      ],
                                      "additionalProperties": false
                                    }
                                  },
                                  "required": [
                                    "invoicedMinor",
                                    "creditedMinor",
                                    "netMinor",
                                    "paidMinor",
                                    "outstandingMinor",
                                    "taxMinor",
                                    "invoiceCount",
                                    "customer"
                                  ],
                                  "additionalProperties": false
                                }
                              }
                            },
                            "required": [
                              "invoicedMinor",
                              "creditedMinor",
                              "netMinor",
                              "paidMinor",
                              "outstandingMinor",
                              "taxMinor",
                              "invoiceCount",
                              "key",
                              "report",
                              "customer"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "quantity": {
                                "type": "string"
                              },
                              "netMinor": {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              "taxMinor": {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              "lineCount": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              },
                              "invoiceCount": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              },
                              "key": {
                                "type": "string"
                              },
                              "report": {
                                "type": "string",
                                "const": "sales-by-item"
                              },
                              "item": {
                                "anyOf": [
                                  {
                                    "type": "object",
                                    "properties": {
                                      "id": {
                                        "type": "string"
                                      },
                                      "label": {
                                        "type": "string"
                                      }
                                    },
                                    "required": [
                                      "id",
                                      "label"
                                    ],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "code": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "quantity",
                              "netMinor",
                              "taxMinor",
                              "lineCount",
                              "invoiceCount",
                              "key",
                              "report",
                              "item",
                              "code"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "quantity": {
                                "type": "string"
                              },
                              "invoiceCount": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              },
                              "key": {
                                "type": "string"
                              },
                              "report": {
                                "type": "string",
                                "const": "delivered-not-billed"
                              },
                              "customer": {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "label": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "id",
                                  "label"
                                ],
                                "additionalProperties": false
                              },
                              "item": {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "label": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "id",
                                  "label"
                                ],
                                "additionalProperties": false
                              },
                              "code": {
                                "type": "string"
                              },
                              "lastDeliveredOn": {
                                "type": "string",
                                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                              }
                            },
                            "required": [
                              "quantity",
                              "invoiceCount",
                              "key",
                              "report",
                              "customer",
                              "item",
                              "code",
                              "lastDeliveredOn"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "invoicedMinor": {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              "creditedMinor": {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              "netMinor": {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              "paidMinor": {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              "outstandingMinor": {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              "taxMinor": {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              "invoiceCount": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              },
                              "key": {
                                "type": "string"
                              },
                              "report": {
                                "type": "string",
                                "const": "sales-by-month"
                              },
                              "month": {
                                "type": "string",
                                "pattern": "^\\d{4}-\\d{2}$"
                              }
                            },
                            "required": [
                              "invoicedMinor",
                              "creditedMinor",
                              "netMinor",
                              "paidMinor",
                              "outstandingMinor",
                              "taxMinor",
                              "invoiceCount",
                              "key",
                              "report",
                              "month"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "netMinor": {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              "taxMinor": {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              "lineCount": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              },
                              "invoiceCount": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              },
                              "key": {
                                "type": "string"
                              },
                              "report": {
                                "type": "string",
                                "const": "tax-collected"
                              },
                              "taxCode": {
                                "anyOf": [
                                  {
                                    "type": "object",
                                    "properties": {
                                      "id": {
                                        "type": "string"
                                      },
                                      "label": {
                                        "type": "string"
                                      }
                                    },
                                    "required": [
                                      "id",
                                      "label"
                                    ],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "region": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "treatment": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              }
                            },
                            "required": [
                              "netMinor",
                              "taxMinor",
                              "lineCount",
                              "invoiceCount",
                              "key",
                              "report",
                              "taxCode",
                              "region",
                              "treatment"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "netMinor": {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              "taxMinor": {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              "totalMinor": {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              "creditedMinor": {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              "balanceMinor": {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              "key": {
                                "type": "string"
                              },
                              "report": {
                                "type": "string",
                                "const": "invoice-register"
                              },
                              "invoice": {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "label": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "id",
                                  "label"
                                ],
                                "additionalProperties": false
                              },
                              "entity": {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "label": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "id",
                                  "label"
                                ],
                                "additionalProperties": false
                              },
                              "customer": {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "label": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "id",
                                  "label"
                                ],
                                "additionalProperties": false
                              },
                              "issueDate": {
                                "type": "string",
                                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                              },
                              "dueDate": {
                                "type": "string",
                                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                              },
                              "status": {
                                "type": "string"
                              },
                              "onBooks": {
                                "type": "boolean"
                              },
                              "sent": {
                                "type": "boolean"
                              },
                              "customerReference": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "taxCodes": {
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "id": {
                                      "type": "string"
                                    },
                                    "label": {
                                      "type": "string"
                                    }
                                  },
                                  "required": [
                                    "id",
                                    "label"
                                  ],
                                  "additionalProperties": false
                                }
                              },
                              "regions": {
                                "type": "array",
                                "items": {
                                  "type": "string"
                                }
                              }
                            },
                            "required": [
                              "netMinor",
                              "taxMinor",
                              "totalMinor",
                              "creditedMinor",
                              "balanceMinor",
                              "key",
                              "report",
                              "invoice",
                              "entity",
                              "customer",
                              "issueDate",
                              "dueDate",
                              "status",
                              "onBooks",
                              "sent"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "currentMinor": {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              "d1to30Minor": {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              "d31to60Minor": {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              "d61to90Minor": {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              "over90Minor": {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              "totalMinor": {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              "unappliedMinor": {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              "key": {
                                "type": "string"
                              },
                              "report": {
                                "type": "string",
                                "const": "ageing"
                              },
                              "customer": {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "label": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "id",
                                  "label"
                                ],
                                "additionalProperties": false
                              },
                              "oldestDueDate": {
                                "anyOf": [
                                  {
                                    "type": "string",
                                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "lastContactAt": {
                                "anyOf": [
                                  {
                                    "type": "string",
                                    "minLength": 20
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "lastContact": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "lateDiscountClaimedMinor": {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              "members": {
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "currentMinor": {
                                      "type": "string",
                                      "pattern": "^-?\\d+$"
                                    },
                                    "d1to30Minor": {
                                      "type": "string",
                                      "pattern": "^-?\\d+$"
                                    },
                                    "d31to60Minor": {
                                      "type": "string",
                                      "pattern": "^-?\\d+$"
                                    },
                                    "d61to90Minor": {
                                      "type": "string",
                                      "pattern": "^-?\\d+$"
                                    },
                                    "over90Minor": {
                                      "type": "string",
                                      "pattern": "^-?\\d+$"
                                    },
                                    "totalMinor": {
                                      "type": "string",
                                      "pattern": "^-?\\d+$"
                                    },
                                    "unappliedMinor": {
                                      "type": "string",
                                      "pattern": "^-?\\d+$"
                                    },
                                    "customer": {
                                      "type": "object",
                                      "properties": {
                                        "id": {
                                          "type": "string"
                                        },
                                        "label": {
                                          "type": "string"
                                        }
                                      },
                                      "required": [
                                        "id",
                                        "label"
                                      ],
                                      "additionalProperties": false
                                    },
                                    "oldestDueDate": {
                                      "anyOf": [
                                        {
                                          "type": "string",
                                          "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                                        },
                                        {
                                          "type": "null"
                                        }
                                      ]
                                    }
                                  },
                                  "required": [
                                    "currentMinor",
                                    "d1to30Minor",
                                    "d31to60Minor",
                                    "d61to90Minor",
                                    "over90Minor",
                                    "totalMinor",
                                    "unappliedMinor",
                                    "customer",
                                    "oldestDueDate"
                                  ],
                                  "additionalProperties": false
                                }
                              }
                            },
                            "required": [
                              "currentMinor",
                              "d1to30Minor",
                              "d31to60Minor",
                              "d61to90Minor",
                              "over90Minor",
                              "totalMinor",
                              "unappliedMinor",
                              "key",
                              "report",
                              "customer",
                              "oldestDueDate"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "deliveryCount": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              },
                              "key": {
                                "type": "string"
                              },
                              "report": {
                                "type": "string",
                                "const": "sends"
                              },
                              "invoice": {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "label": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "id",
                                  "label"
                                ],
                                "additionalProperties": false
                              },
                              "customer": {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "label": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "id",
                                  "label"
                                ],
                                "additionalProperties": false
                              },
                              "recipient": {
                                "type": "string"
                              },
                              "role": {
                                "type": "string"
                              },
                              "status": {
                                "type": "string"
                              },
                              "sentAt": {
                                "anyOf": [
                                  {
                                    "type": "string",
                                    "minLength": 20
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "attemptedAt": {
                                "type": "string",
                                "minLength": 20
                              },
                              "language": {
                                "type": "string"
                              },
                              "sentBy": {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "label": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "id",
                                  "label"
                                ],
                                "additionalProperties": false
                              },
                              "error": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              }
                            },
                            "required": [
                              "deliveryCount",
                              "key",
                              "report",
                              "invoice",
                              "customer",
                              "recipient",
                              "role",
                              "status",
                              "sentAt",
                              "attemptedAt",
                              "language",
                              "sentBy",
                              "error"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "subtotalMinor": {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              "taxMinor": {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              "totalMinor": {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              "appliedMinor": {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              "memoCount": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              },
                              "key": {
                                "type": "string"
                              },
                              "report": {
                                "type": "string",
                                "const": "credit-memos"
                              },
                              "memo": {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "label": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "id",
                                  "label"
                                ],
                                "additionalProperties": false
                              },
                              "entity": {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "label": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "id",
                                  "label"
                                ],
                                "additionalProperties": false
                              },
                              "customer": {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "label": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "id",
                                  "label"
                                ],
                                "additionalProperties": false
                              },
                              "against": {
                                "anyOf": [
                                  {
                                    "type": "object",
                                    "properties": {
                                      "id": {
                                        "type": "string"
                                      },
                                      "label": {
                                        "type": "string"
                                      }
                                    },
                                    "required": [
                                      "id",
                                      "label"
                                    ],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "issueDate": {
                                "type": "string",
                                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                              },
                              "status": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "subtotalMinor",
                              "taxMinor",
                              "totalMinor",
                              "appliedMinor",
                              "memoCount",
                              "key",
                              "report",
                              "memo",
                              "entity",
                              "customer",
                              "against",
                              "issueDate",
                              "status"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "openingMinor": {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              "addedMinor": {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              "releasedMinor": {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              "closingMinor": {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              "unexplainedMinor": {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              "key": {
                                "type": "string"
                              },
                              "report": {
                                "type": "string",
                                "const": "deferred-revenue"
                              },
                              "month": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "openingMinor",
                              "addedMinor",
                              "releasedMinor",
                              "closingMinor",
                              "unexplainedMinor",
                              "key",
                              "report",
                              "month"
                            ],
                            "additionalProperties": false
                          }
                        ]
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "rowCount": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "totalRow": {
                      "oneOf": [
                        {
                          "type": "object",
                          "properties": {
                            "invoicedMinor": {
                              "type": "string",
                              "pattern": "^-?\\d+$"
                            },
                            "creditedMinor": {
                              "type": "string",
                              "pattern": "^-?\\d+$"
                            },
                            "netMinor": {
                              "type": "string",
                              "pattern": "^-?\\d+$"
                            },
                            "paidMinor": {
                              "type": "string",
                              "pattern": "^-?\\d+$"
                            },
                            "outstandingMinor": {
                              "type": "string",
                              "pattern": "^-?\\d+$"
                            },
                            "taxMinor": {
                              "type": "string",
                              "pattern": "^-?\\d+$"
                            },
                            "invoiceCount": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "report": {
                              "type": "string",
                              "const": "sales-by-customer"
                            }
                          },
                          "required": [
                            "invoicedMinor",
                            "creditedMinor",
                            "netMinor",
                            "paidMinor",
                            "outstandingMinor",
                            "taxMinor",
                            "invoiceCount",
                            "report"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "quantity": {
                              "type": "string"
                            },
                            "netMinor": {
                              "type": "string",
                              "pattern": "^-?\\d+$"
                            },
                            "taxMinor": {
                              "type": "string",
                              "pattern": "^-?\\d+$"
                            },
                            "lineCount": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "invoiceCount": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "report": {
                              "type": "string",
                              "const": "sales-by-item"
                            }
                          },
                          "required": [
                            "quantity",
                            "netMinor",
                            "taxMinor",
                            "lineCount",
                            "invoiceCount",
                            "report"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "quantity": {
                              "type": "string"
                            },
                            "invoiceCount": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "report": {
                              "type": "string",
                              "const": "delivered-not-billed"
                            }
                          },
                          "required": [
                            "quantity",
                            "invoiceCount",
                            "report"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "invoicedMinor": {
                              "type": "string",
                              "pattern": "^-?\\d+$"
                            },
                            "creditedMinor": {
                              "type": "string",
                              "pattern": "^-?\\d+$"
                            },
                            "netMinor": {
                              "type": "string",
                              "pattern": "^-?\\d+$"
                            },
                            "paidMinor": {
                              "type": "string",
                              "pattern": "^-?\\d+$"
                            },
                            "outstandingMinor": {
                              "type": "string",
                              "pattern": "^-?\\d+$"
                            },
                            "taxMinor": {
                              "type": "string",
                              "pattern": "^-?\\d+$"
                            },
                            "invoiceCount": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "report": {
                              "type": "string",
                              "const": "sales-by-month"
                            }
                          },
                          "required": [
                            "invoicedMinor",
                            "creditedMinor",
                            "netMinor",
                            "paidMinor",
                            "outstandingMinor",
                            "taxMinor",
                            "invoiceCount",
                            "report"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "netMinor": {
                              "type": "string",
                              "pattern": "^-?\\d+$"
                            },
                            "taxMinor": {
                              "type": "string",
                              "pattern": "^-?\\d+$"
                            },
                            "lineCount": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "invoiceCount": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "report": {
                              "type": "string",
                              "const": "tax-collected"
                            }
                          },
                          "required": [
                            "netMinor",
                            "taxMinor",
                            "lineCount",
                            "invoiceCount",
                            "report"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "netMinor": {
                              "type": "string",
                              "pattern": "^-?\\d+$"
                            },
                            "taxMinor": {
                              "type": "string",
                              "pattern": "^-?\\d+$"
                            },
                            "totalMinor": {
                              "type": "string",
                              "pattern": "^-?\\d+$"
                            },
                            "creditedMinor": {
                              "type": "string",
                              "pattern": "^-?\\d+$"
                            },
                            "balanceMinor": {
                              "type": "string",
                              "pattern": "^-?\\d+$"
                            },
                            "report": {
                              "type": "string",
                              "const": "invoice-register"
                            },
                            "invoiceCount": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "notOnBooks": {
                              "type": "object",
                              "properties": {
                                "invoiceCount": {
                                  "type": "integer",
                                  "minimum": 0,
                                  "maximum": 9007199254740991
                                },
                                "totalMinor": {
                                  "type": "string",
                                  "pattern": "^-?\\d+$"
                                }
                              },
                              "required": [
                                "invoiceCount",
                                "totalMinor"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "required": [
                            "netMinor",
                            "taxMinor",
                            "totalMinor",
                            "creditedMinor",
                            "balanceMinor",
                            "report",
                            "invoiceCount"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "currentMinor": {
                              "type": "string",
                              "pattern": "^-?\\d+$"
                            },
                            "d1to30Minor": {
                              "type": "string",
                              "pattern": "^-?\\d+$"
                            },
                            "d31to60Minor": {
                              "type": "string",
                              "pattern": "^-?\\d+$"
                            },
                            "d61to90Minor": {
                              "type": "string",
                              "pattern": "^-?\\d+$"
                            },
                            "over90Minor": {
                              "type": "string",
                              "pattern": "^-?\\d+$"
                            },
                            "totalMinor": {
                              "type": "string",
                              "pattern": "^-?\\d+$"
                            },
                            "unappliedMinor": {
                              "type": "string",
                              "pattern": "^-?\\d+$"
                            },
                            "report": {
                              "type": "string",
                              "const": "ageing"
                            }
                          },
                          "required": [
                            "currentMinor",
                            "d1to30Minor",
                            "d31to60Minor",
                            "d61to90Minor",
                            "over90Minor",
                            "totalMinor",
                            "unappliedMinor",
                            "report"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "deliveryCount": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "report": {
                              "type": "string",
                              "const": "sends"
                            }
                          },
                          "required": [
                            "deliveryCount",
                            "report"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "subtotalMinor": {
                              "type": "string",
                              "pattern": "^-?\\d+$"
                            },
                            "taxMinor": {
                              "type": "string",
                              "pattern": "^-?\\d+$"
                            },
                            "totalMinor": {
                              "type": "string",
                              "pattern": "^-?\\d+$"
                            },
                            "appliedMinor": {
                              "type": "string",
                              "pattern": "^-?\\d+$"
                            },
                            "memoCount": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "report": {
                              "type": "string",
                              "const": "credit-memos"
                            }
                          },
                          "required": [
                            "subtotalMinor",
                            "taxMinor",
                            "totalMinor",
                            "appliedMinor",
                            "memoCount",
                            "report"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "openingMinor": {
                              "type": "string",
                              "pattern": "^-?\\d+$"
                            },
                            "addedMinor": {
                              "type": "string",
                              "pattern": "^-?\\d+$"
                            },
                            "releasedMinor": {
                              "type": "string",
                              "pattern": "^-?\\d+$"
                            },
                            "closingMinor": {
                              "type": "string",
                              "pattern": "^-?\\d+$"
                            },
                            "unexplainedMinor": {
                              "type": "string",
                              "pattern": "^-?\\d+$"
                            },
                            "report": {
                              "type": "string",
                              "const": "deferred-revenue"
                            }
                          },
                          "required": [
                            "openingMinor",
                            "addedMinor",
                            "releasedMinor",
                            "closingMinor",
                            "unexplainedMinor",
                            "report"
                          ],
                          "additionalProperties": false
                        }
                      ]
                    },
                    "notes": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "filters": {
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {
                        "type": "string"
                      }
                    },
                    "tie": {
                      "type": "object",
                      "properties": {
                        "entityId": {
                          "type": "string"
                        },
                        "entityName": {
                          "type": "string"
                        },
                        "asOf": {
                          "type": "string",
                          "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                        },
                        "currency": {
                          "type": "string",
                          "pattern": "^[A-Z]{3}$"
                        },
                        "subledgerMinor": {
                          "type": "string",
                          "pattern": "^-?\\d+$"
                        },
                        "controlMinor": {
                          "type": "string",
                          "pattern": "^-?\\d+$"
                        },
                        "unexplainedMinor": {
                          "type": "string",
                          "pattern": "^-?\\d+$"
                        },
                        "customerCreditReclass": {
                          "$ref": "#/components/schemas/CustomerCreditReclass"
                        },
                        "fxRevaluation": {
                          "$ref": "#/components/schemas/CustomerCreditReclass"
                        },
                        "controlAccounts": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "code": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "id",
                              "code",
                              "name"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "tied": {
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "entityId",
                        "entityName",
                        "asOf",
                        "currency",
                        "subledgerMinor",
                        "controlMinor",
                        "unexplainedMinor",
                        "controlAccounts",
                        "tied"
                      ],
                      "additionalProperties": false
                    },
                    "ties": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "type": "string",
                            "enum": [
                              "RECEIVABLE",
                              "REVENUE"
                            ]
                          },
                          "label": {
                            "type": "string"
                          },
                          "reportMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "booksMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "differenceMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "tied": {
                            "type": "boolean"
                          },
                          "sentence": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "kind",
                          "label",
                          "reportMinor",
                          "booksMinor",
                          "differenceMinor",
                          "tied",
                          "sentence"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "report",
                    "title",
                    "description",
                    "currency",
                    "asOf",
                    "columns",
                    "rows",
                    "nextCursor",
                    "rowCount",
                    "totalRow",
                    "notes",
                    "filters"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "404": {
            "$ref": "#/components/responses/Problem404"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/sales/views": {
      "get": {
        "operationId": "listSavedReportViews",
        "summary": "Lists the saved views of the sales reports.",
        "description": "Lists the saved views of the sales reports. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "report",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "sales-by-customer",
                "sales-by-item",
                "delivered-not-billed",
                "sales-by-month",
                "tax-collected",
                "invoice-register",
                "ageing",
                "sends",
                "credit-memos",
                "deferred-revenue"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "views": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ViewsItem"
                      }
                    },
                    "total": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "perReportLimit": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 9007199254740991
                    }
                  },
                  "required": [
                    "views",
                    "total",
                    "perReportLimit"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      },
      "post": {
        "operationId": "saveReportView",
        "summary": "Saves a view of a sales report under a name.",
        "description": "Saves a view of a sales report under a name. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "report": {
                    "type": "string",
                    "enum": [
                      "sales-by-customer",
                      "sales-by-item",
                      "delivered-not-billed",
                      "sales-by-month",
                      "tax-collected",
                      "invoice-register",
                      "ageing",
                      "sends",
                      "credit-memos",
                      "deferred-revenue"
                    ]
                  },
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 80
                  },
                  "filters": {
                    "type": "object",
                    "propertyNames": {
                      "type": "string"
                    },
                    "additionalProperties": {
                      "type": "string"
                    }
                  }
                },
                "required": [
                  "report",
                  "name",
                  "filters"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "Ledger-Position": {
                "$ref": "#/components/headers/LedgerPosition"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ViewsItem"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem400"
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "409": {
            "$ref": "#/components/responses/Problem409"
          },
          "412": {
            "$ref": "#/components/responses/Problem412"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/sales/views/{viewId}": {
      "patch": {
        "operationId": "renameReportView",
        "summary": "Renames a saved sales report view.",
        "description": "Renames a saved sales report view. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "viewId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 80
                  }
                },
                "required": [
                  "name"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "Ledger-Position": {
                "$ref": "#/components/headers/LedgerPosition"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ViewsItem"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem400"
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "404": {
            "$ref": "#/components/responses/Problem404"
          },
          "409": {
            "$ref": "#/components/responses/Problem409"
          },
          "412": {
            "$ref": "#/components/responses/Problem412"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      },
      "delete": {
        "operationId": "deleteReportView",
        "summary": "Deletes a saved sales report view.",
        "description": "Deletes a saved sales report view. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "viewId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "Ledger-Position": {
                "$ref": "#/components/headers/LedgerPosition"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "id",
                    "name"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem400"
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "404": {
            "$ref": "#/components/responses/Problem404"
          },
          "409": {
            "$ref": "#/components/responses/Problem409"
          },
          "412": {
            "$ref": "#/components/responses/Problem412"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/statements": {
      "get": {
        "operationId": "statements",
        "summary": "Returns the financial statements for the ledger over a period.",
        "description": "Returns the financial statements for the ledger over a period. Needs the `statements:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "statements:read",
        "parameters": [
          {
            "name": "entityId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "asOf",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "entityId": {
                      "type": "string"
                    },
                    "entityName": {
                      "type": "string"
                    },
                    "asOf": {
                      "type": "string"
                    },
                    "timeZone": {
                      "type": "string"
                    },
                    "currency": {
                      "type": "string"
                    },
                    "sections": {
                      "$ref": "#/components/schemas/Sections"
                    },
                    "totalDebitMinor": {
                      "type": "string",
                      "pattern": "^-?\\d+$"
                    },
                    "totalCreditMinor": {
                      "type": "string",
                      "pattern": "^-?\\d+$"
                    },
                    "balanced": {
                      "type": "boolean"
                    },
                    "periodStart": {
                      "type": "string"
                    },
                    "periodNote": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "periodSections": {
                      "$ref": "#/components/schemas/Sections"
                    },
                    "cashFlow": {
                      "type": "object",
                      "properties": {
                        "netIncomeMinor": {
                          "type": "string",
                          "pattern": "^-?\\d+$"
                        },
                        "nonCashLines": {
                          "$ref": "#/components/schemas/NonCashLines"
                        },
                        "nonCashMinor": {
                          "type": "string",
                          "pattern": "^-?\\d+$"
                        },
                        "workingCapitalLines": {
                          "$ref": "#/components/schemas/NonCashLines"
                        },
                        "workingCapitalMinor": {
                          "type": "string",
                          "pattern": "^-?\\d+$"
                        },
                        "sections": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "section": {
                                "type": "string",
                                "enum": [
                                  "OPERATING",
                                  "INVESTING",
                                  "FINANCING"
                                ]
                              },
                              "lines": {
                                "$ref": "#/components/schemas/NonCashLines"
                              },
                              "totalMinor": {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              }
                            },
                            "required": [
                              "section",
                              "lines",
                              "totalMinor"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "netChangeMinor": {
                          "type": "string",
                          "pattern": "^-?\\d+$"
                        },
                        "cashMovementMinor": {
                          "type": "string",
                          "pattern": "^-?\\d+$"
                        },
                        "openingCashMinor": {
                          "type": "string",
                          "pattern": "^-?\\d+$"
                        },
                        "closingCashMinor": {
                          "type": "string",
                          "pattern": "^-?\\d+$"
                        },
                        "unclassifiedLines": {
                          "$ref": "#/components/schemas/NonCashLines"
                        },
                        "unclassifiedMinor": {
                          "type": "string",
                          "pattern": "^-?\\d+$"
                        },
                        "reclassifiedLines": {
                          "$ref": "#/components/schemas/NonCashLines"
                        },
                        "ties": {
                          "type": "boolean"
                        },
                        "cashAccountCount": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        }
                      },
                      "required": [
                        "netIncomeMinor",
                        "nonCashLines",
                        "nonCashMinor",
                        "workingCapitalLines",
                        "workingCapitalMinor",
                        "sections",
                        "netChangeMinor",
                        "cashMovementMinor",
                        "openingCashMinor",
                        "closingCashMinor",
                        "unclassifiedLines",
                        "unclassifiedMinor",
                        "reclassifiedLines",
                        "ties",
                        "cashAccountCount"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "entityId",
                    "entityName",
                    "asOf",
                    "timeZone",
                    "currency",
                    "sections",
                    "totalDebitMinor",
                    "totalCreditMinor",
                    "balanced",
                    "periodStart",
                    "periodNote",
                    "periodSections",
                    "cashFlow"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/statements/monthly": {
      "get": {
        "operationId": "monthlySeries",
        "summary": "Returns the monthly figures behind the statements, one series per line.",
        "description": "Returns the monthly figures behind the statements, one series per line. Needs the `statements:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "sales"
        ],
        "x-stability-level": "beta",
        "x-scope": "statements:read",
        "parameters": [
          {
            "name": "entityId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "asOf",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
            }
          },
          {
            "name": "from",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "entityId": {
                      "type": "string"
                    },
                    "entityName": {
                      "type": "string"
                    },
                    "asOf": {
                      "type": "string"
                    },
                    "timeZone": {
                      "type": "string"
                    },
                    "currency": {
                      "type": "string"
                    },
                    "periodStart": {
                      "type": "string"
                    },
                    "periodNote": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "cashAccountCount": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "months": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "month": {
                            "type": "string",
                            "pattern": "^\\d{4}-\\d{2}$"
                          },
                          "revenueMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "expenseMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "netIncomeMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "closingCashMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          }
                        },
                        "required": [
                          "month",
                          "revenueMinor",
                          "expenseMinor",
                          "netIncomeMinor",
                          "closingCashMinor"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "entityId",
                    "entityName",
                    "asOf",
                    "timeZone",
                    "currency",
                    "periodStart",
                    "periodNote",
                    "cashAccountCount",
                    "months"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    }
  },
  "webhooks": {},
  "components": {
    "securitySchemes": {
      "apiKey": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "evk_ API key",
        "description": "A key an administrator of the books made in the app. It reads, or reads and drafts, on one ledger."
      },
      "oauth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "description": "An access token for a person who connected an app. Its audience is https://api.eternifylabs.com/v1. The app acts with that person's own role, inside what they allowed."
      }
    },
    "schemas": {
      "Account": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "code": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "code",
              "name"
            ],
            "additionalProperties": false
          },
          {
            "type": "null"
          }
        ]
      },
      "Addresses": {
        "type": "array",
        "items": {
          "$ref": "#/components/schemas/AddressesItem"
        }
      },
      "AddressesItem": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "customerId": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "enum": [
              "BILLING",
              "SHIP_TO"
            ]
          },
          "isDefault": {
            "type": "boolean"
          },
          "label": {
            "type": [
              "string",
              "null"
            ]
          },
          "line1": {
            "type": "string"
          },
          "line2": {
            "type": [
              "string",
              "null"
            ]
          },
          "city": {
            "type": [
              "string",
              "null"
            ]
          },
          "region": {
            "type": [
              "string",
              "null"
            ]
          },
          "postalCode": {
            "type": [
              "string",
              "null"
            ]
          },
          "country": {
            "type": "string"
          },
          "needsSplit": {
            "type": "boolean"
          },
          "placeId": {
            "type": [
              "string",
              "null"
            ]
          },
          "onReserve": {
            "type": "boolean"
          },
          "lines": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "createdBy": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  }
                },
                "required": [
                  "id",
                  "name"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "createdAt": {
            "type": "string",
            "minLength": 20
          },
          "updatedAt": {
            "type": "string",
            "minLength": 20
          },
          "removedAt": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 20
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "customerId",
          "kind",
          "isDefault",
          "label",
          "line1",
          "line2",
          "city",
          "region",
          "postalCode",
          "country",
          "needsSplit",
          "placeId",
          "lines",
          "createdBy",
          "createdAt",
          "updatedAt",
          "removedAt"
        ],
        "additionalProperties": false
      },
      "AddressesItem2": {
        "type": "object",
        "properties": {
          "line1": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "line2": {
            "type": "string",
            "maxLength": 200
          },
          "city": {
            "type": "string",
            "minLength": 1,
            "maxLength": 120
          },
          "region": {
            "type": "string",
            "maxLength": 5
          },
          "postalCode": {
            "type": "string",
            "maxLength": 20
          },
          "country": {
            "default": "CA",
            "type": "string",
            "pattern": "^[A-Z]{2}$"
          },
          "placeId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 300
          },
          "label": {
            "type": "string",
            "maxLength": 80
          },
          "kind": {
            "type": "string",
            "enum": [
              "BILLING",
              "SHIP_TO"
            ]
          },
          "isDefault": {
            "type": "boolean"
          },
          "onReserve": {
            "type": "boolean"
          }
        },
        "required": [
          "line1",
          "city",
          "kind"
        ],
        "additionalProperties": false
      },
      "Applications": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "invoiceId": {
              "type": "string"
            },
            "invoiceNumber": {
              "type": "string"
            },
            "amountMinor": {
              "type": "string",
              "pattern": "^-?\\d+$"
            },
            "discountTakenMinor": {
              "type": "string",
              "pattern": "^-?\\d+$"
            }
          },
          "required": [
            "invoiceId",
            "invoiceNumber",
            "amountMinor"
          ],
          "additionalProperties": false
        }
      },
      "Applications2": {
        "default": [],
        "maxItems": 200,
        "type": "array",
        "items": {
          "$ref": "#/components/schemas/Applications2Item"
        }
      },
      "Applications2Item": {
        "type": "object",
        "properties": {
          "invoiceId": {
            "type": "string",
            "minLength": 1
          },
          "amountMinor": {
            "type": "string",
            "pattern": "^-?\\d+$"
          },
          "discountTakenMinor": {
            "type": "string",
            "pattern": "^-?\\d+$"
          }
        },
        "required": [
          "invoiceId",
          "amountMinor"
        ],
        "additionalProperties": false
      },
      "ApproveCustomerProposalResponse": {
        "type": "object",
        "properties": {
          "proposalId": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "APPROVED",
              "REJECTED"
            ]
          },
          "customerId": {
            "type": [
              "string",
              "null"
            ]
          },
          "displayName": {
            "type": "string"
          },
          "decidedBy": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "name"
            ],
            "additionalProperties": false
          },
          "decidedAt": {
            "type": "string",
            "minLength": 20
          },
          "reason": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "proposalId",
          "status",
          "customerId",
          "displayName",
          "decidedBy",
          "decidedAt",
          "reason"
        ],
        "additionalProperties": false
      },
      "ArchiveCustomerResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "displayName": {
            "type": "string"
          },
          "customFields": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "boolean"
                },
                {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                }
              ]
            }
          },
          "taxStatus": {
            "type": "string",
            "enum": [
              "STANDARD",
              "INDIAN_ACT_S87_RELIEF"
            ]
          },
          "legalName": {
            "type": [
              "string",
              "null"
            ]
          },
          "customerKey": {
            "type": "string"
          },
          "country": {
            "type": "string"
          },
          "region": {
            "type": [
              "string",
              "null"
            ]
          },
          "email": {
            "type": [
              "string",
              "null"
            ]
          },
          "phone": {
            "type": [
              "string",
              "null"
            ]
          },
          "address": {
            "type": [
              "string",
              "null"
            ]
          },
          "notes": {
            "type": [
              "string",
              "null"
            ]
          },
          "website": {
            "type": [
              "string",
              "null"
            ]
          },
          "language": {
            "type": "string",
            "enum": [
              "en",
              "fr"
            ]
          },
          "gstHstNumber": {
            "type": [
              "string",
              "null"
            ]
          },
          "qstNumber": {
            "type": [
              "string",
              "null"
            ]
          },
          "pstNumber": {
            "type": [
              "string",
              "null"
            ]
          },
          "billingAddress": {
            "type": [
              "string",
              "null"
            ]
          },
          "terms": {
            "$ref": "#/components/schemas/PaymentTerms"
          },
          "ownTerms": {
            "type": "boolean"
          },
          "contacts": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "email": {
                  "type": "string"
                },
                "role": {
                  "type": "string",
                  "enum": [
                    "BILLING",
                    "CC",
                    "ESCALATION"
                  ]
                },
                "phone": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "bouncingSince": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 20
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "bounceReason": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              },
              "required": [
                "id",
                "name",
                "email",
                "role",
                "bouncingSince",
                "bounceReason"
              ],
              "additionalProperties": false
            }
          },
          "addresses": {
            "$ref": "#/components/schemas/Addresses"
          },
          "status": {
            "type": "string",
            "enum": [
              "ACTIVE",
              "ARCHIVED"
            ]
          },
          "archivedAt": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 20
              },
              {
                "type": "null"
              }
            ]
          },
          "archivedBy": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  }
                },
                "required": [
                  "id",
                  "name"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "archiveReason": {
            "type": [
              "string",
              "null"
            ]
          },
          "openBalanceMinor": {
            "type": "string",
            "pattern": "^-?\\d+$"
          },
          "openInvoiceCount": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "lastInvoiceDate": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
              },
              {
                "type": "null"
              }
            ]
          },
          "unappliedMinor": {
            "type": "string",
            "pattern": "^-?\\d+$"
          },
          "depositsMinor": {
            "type": "string",
            "pattern": "^-?\\d+$"
          },
          "creditLimitMinor": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^-?\\d+$"
              },
              {
                "type": "null"
              }
            ]
          },
          "pastDue": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "pastDueMinor": {
                    "type": "string",
                    "pattern": "^-?\\d+$"
                  },
                  "currency": {
                    "type": "string",
                    "pattern": "^[A-Z]{3}$"
                  }
                },
                "required": [
                  "pastDueMinor",
                  "currency"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "exposureMinor": {
            "type": "string",
            "pattern": "^-?\\d+$"
          },
          "exposureUnconverted": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "invoiceId": {
                  "type": "string"
                },
                "currency": {
                  "type": "string",
                  "pattern": "^[A-Z]{3}$"
                },
                "issueDate": {
                  "type": "string",
                  "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                },
                "totalMinor": {
                  "type": "string",
                  "pattern": "^-?\\d+$"
                }
              },
              "required": [
                "invoiceId",
                "currency",
                "issueDate",
                "totalMinor"
              ],
              "additionalProperties": false
            }
          },
          "overLimit": {
            "type": "boolean"
          },
          "onHold": {
            "type": "boolean"
          },
          "holdReason": {
            "type": [
              "string",
              "null"
            ]
          },
          "holdBy": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  }
                },
                "required": [
                  "id",
                  "name"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "holdAt": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 20
              },
              {
                "type": "null"
              }
            ]
          },
          "creditRating": {
            "type": "object",
            "properties": {
              "score": {
                "type": "integer",
                "minimum": 0,
                "maximum": 100
              },
              "band": {
                "type": "string",
                "enum": [
                  "A",
                  "B",
                  "C",
                  "D",
                  "E",
                  "N"
                ]
              },
              "effectiveBand": {
                "type": "string",
                "enum": [
                  "A",
                  "B",
                  "C",
                  "D",
                  "E",
                  "N"
                ]
              },
              "factors": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": [
                        "LATENESS",
                        "ON_TIME_SHARE",
                        "OVERDUE_SHARE",
                        "LIMIT_USE",
                        "RETURNED_PAYMENTS",
                        "DISPUTES"
                      ]
                    },
                    "label": {
                      "type": "string"
                    },
                    "measured": {
                      "type": "string"
                    },
                    "points": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    }
                  },
                  "required": [
                    "code",
                    "label",
                    "measured",
                    "points"
                  ],
                  "additionalProperties": false
                }
              },
              "headline": {
                "type": "string"
              },
              "policyVersion": {
                "type": "string"
              },
              "asOf": {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
              },
              "capped": {
                "anyOf": [
                  {
                    "type": "string",
                    "enum": [
                      "WRITE_OFF",
                      "OVER_90"
                    ]
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "thinFile": {
                "type": "boolean"
              },
              "override": {
                "anyOf": [
                  {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string"
                      },
                      "band": {
                        "type": "string",
                        "enum": [
                          "A",
                          "B",
                          "C",
                          "D",
                          "E"
                        ]
                      },
                      "reason": {
                        "type": "string"
                      },
                      "setBy": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "id",
                          "name"
                        ],
                        "additionalProperties": false
                      },
                      "setAt": {
                        "type": "string",
                        "minLength": 20
                      },
                      "expiresOn": {
                        "anyOf": [
                          {
                            "type": "string",
                            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      }
                    },
                    "required": [
                      "id",
                      "band",
                      "reason",
                      "setBy",
                      "setAt",
                      "expiresOn"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "score",
              "band",
              "effectiveBand",
              "factors",
              "headline",
              "policyVersion",
              "asOf",
              "capped",
              "thinFile",
              "override"
            ],
            "additionalProperties": false
          },
          "links": {
            "$ref": "#/components/schemas/Links"
          },
          "parent": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "displayName": {
                    "type": "string"
                  }
                },
                "required": [
                  "id",
                  "displayName"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "childCount": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "invoicesToParent": {
            "type": "boolean"
          },
          "relatedParty": {
            "type": "boolean"
          },
          "relatedPartyNote": {
            "type": [
              "string",
              "null"
            ]
          },
          "businessNumber": {
            "type": [
              "string",
              "null"
            ]
          },
          "corporation": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "number": {
                    "type": "string"
                  },
                  "jurisdiction": {
                    "type": "string",
                    "enum": [
                      "FEDERAL",
                      "AB",
                      "BC",
                      "MB",
                      "NB",
                      "NL",
                      "NS",
                      "NT",
                      "NU",
                      "ON",
                      "PE",
                      "QC",
                      "SK",
                      "YT"
                    ]
                  }
                },
                "required": [
                  "number",
                  "jurisdiction"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "defaultCurrency": {
            "type": [
              "string",
              "null"
            ]
          },
          "defaultEntity": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  }
                },
                "required": [
                  "id",
                  "name"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "defaultDepartment": {
            "$ref": "#/components/schemas/DefaultDepartment"
          },
          "creditInsurance": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "insurer": {
                    "type": "string"
                  },
                  "policyNumber": {
                    "type": "string"
                  },
                  "insuredLimitMinor": {
                    "type": "string",
                    "pattern": "^-?\\d+$"
                  },
                  "expiresOn": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  }
                },
                "required": [
                  "insurer",
                  "policyNumber",
                  "insuredLimitMinor",
                  "expiresOn"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "createdFromProposalId": {
            "type": [
              "string",
              "null"
            ]
          },
          "createdBy": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "name"
            ],
            "additionalProperties": false
          },
          "createdAt": {
            "type": "string",
            "minLength": 20
          },
          "updatedAt": {
            "type": "string",
            "minLength": 20
          }
        },
        "required": [
          "id",
          "displayName",
          "legalName",
          "customerKey",
          "country",
          "region",
          "email",
          "phone",
          "address",
          "notes",
          "language",
          "gstHstNumber",
          "qstNumber",
          "pstNumber",
          "billingAddress",
          "terms",
          "ownTerms",
          "contacts",
          "status",
          "archivedAt",
          "archivedBy",
          "archiveReason",
          "openBalanceMinor",
          "openInvoiceCount",
          "lastInvoiceDate",
          "unappliedMinor",
          "depositsMinor",
          "creditLimitMinor",
          "pastDue",
          "exposureMinor",
          "overLimit",
          "onHold",
          "holdReason",
          "holdBy",
          "holdAt",
          "creditRating",
          "links",
          "createdBy",
          "createdAt",
          "updatedAt"
        ],
        "additionalProperties": false
      },
      "AuditLogResponse": {
        "type": "object",
        "properties": {
          "data": {
            "$ref": "#/components/schemas/History"
          },
          "nextCursor": {
            "type": [
              "string",
              "null"
            ]
          },
          "total": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ]
          },
          "imported": {
            "$ref": "#/components/schemas/Imported"
          },
          "totals": {
            "$ref": "#/components/schemas/Totals"
          },
          "origin": {
            "type": "string",
            "enum": [
              "ALL",
              "NATIVE",
              "IMPORTED"
            ]
          },
          "zone": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "data",
          "nextCursor",
          "total",
          "imported",
          "totals",
          "origin",
          "zone"
        ],
        "additionalProperties": false
      },
      "Batch": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "invoiceCount": {
                "type": "integer",
                "minimum": 1,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "id",
              "invoiceCount"
            ],
            "additionalProperties": false
          },
          {
            "type": "null"
          }
        ]
      },
      "Billing": {
        "type": "object",
        "properties": {
          "currency": {
            "type": "string",
            "pattern": "^[A-Z]{3}$"
          },
          "invoiceCount": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "invoiced": {
            "$ref": "#/components/schemas/Invoiced"
          },
          "credited": {
            "$ref": "#/components/schemas/Invoiced"
          },
          "drafts": {
            "type": "object",
            "properties": {
              "count": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "netMinor": {
                "type": "string",
                "pattern": "^-?\\d+$"
              },
              "grossMinor": {
                "type": "string",
                "pattern": "^-?\\d+$"
              }
            },
            "required": [
              "count",
              "netMinor",
              "grossMinor"
            ],
            "additionalProperties": false
          },
          "remainingMinor": {
            "type": "string",
            "pattern": "^-?\\d+$"
          },
          "holdbackHeldMinor": {
            "type": "string",
            "pattern": "^-?\\d+$"
          },
          "percentCompleteBp": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "poDifferenceMinor": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^-?\\d+$"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "currency",
          "invoiceCount",
          "invoiced",
          "credited",
          "drafts"
        ],
        "additionalProperties": false
      },
      "Breaker": {
        "type": "object",
        "properties": {
          "paused": {
            "type": "boolean"
          },
          "hardBounces": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "window": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "thresholdBp": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          }
        },
        "required": [
          "paused",
          "hardBounces",
          "window",
          "thresholdBp"
        ],
        "additionalProperties": false
      },
      "Cap": {
        "type": "object",
        "properties": {
          "limit": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "sentToday": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "remaining": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "timeZone": {
            "type": "string"
          }
        },
        "required": [
          "limit",
          "sentToday",
          "remaining",
          "timeZone"
        ],
        "additionalProperties": false
      },
      "Cells": {
        "type": "object",
        "propertyNames": {
          "$ref": "#/components/schemas/MappingValue"
        },
        "additionalProperties": {
          "type": "string"
        }
      },
      "Change": {
        "oneOf": [
          {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "const": "DUE_DATE"
              },
              "dueDate": {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
              }
            },
            "required": [
              "kind",
              "dueDate"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "const": "TERMS"
              },
              "paymentTermsId": {
                "type": "string",
                "minLength": 1
              }
            },
            "required": [
              "kind",
              "paymentTermsId"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "const": "MEMO"
              },
              "memo": {
                "type": "string",
                "minLength": 1,
                "maxLength": 500
              }
            },
            "required": [
              "kind",
              "memo"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "const": "LINE_ACCOUNT"
              },
              "fromAccountId": {
                "type": "string",
                "minLength": 1
              },
              "toAccountId": {
                "type": "string",
                "minLength": 1
              }
            },
            "required": [
              "kind",
              "fromAccountId",
              "toAccountId"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "const": "DIMENSION"
              },
              "dimensionTypeId": {
                "type": "string",
                "minLength": 1
              },
              "dimensionValueId": {
                "type": "string",
                "minLength": 1
              }
            },
            "required": [
              "kind",
              "dimensionTypeId",
              "dimensionValueId"
            ],
            "additionalProperties": false
          }
        ]
      },
      "Code": {
        "type": "string",
        "x-extensible-enum": [
          "validation_failed",
          "unauthenticated",
          "permission_denied",
          "not_found",
          "precondition_failed",
          "idempotency_conflict",
          "idempotency_in_flight",
          "conflict",
          "counterparty_link_taken",
          "payload_too_large",
          "write_conflict",
          "audit_chain_order",
          "unsupported_version",
          "service_unavailable",
          "not_implemented",
          "rate_limited",
          "payment_required",
          "bad_gateway",
          "internal_error",
          "account_not_active",
          "approval_required",
          "currency_tuple",
          "dimension_policy",
          "entry_changed",
          "gifi_code",
          "gifi_mismatch",
          "gifi_reserved_total",
          "illegal_transition",
          "invalid_draft",
          "invalid_money",
          "materiality_exceeded",
          "payment_file_invalid",
          "period_locked",
          "separation_of_duties",
          "tax_account_not_recurring",
          "tax_check_finding_not_open",
          "unbalanced_entry",
          "invalid_tax_input",
          "unsupported_tax_rule",
          "ai_budget_exceeded",
          "disclosure_not_accepted",
          "invalid_prompt",
          "model_output_unparsable",
          "model_refused",
          "connector_sync_unavailable",
          "no_model_provider",
          "not_in_review_queue",
          "company_domain_personal",
          "company_domain_missing",
          "company_not_found",
          "company_person_not_listed",
          "provider_key_missing",
          "provider_key_refused",
          "provider_unavailable",
          "provider_credits_exhausted",
          "api_key_label_taken",
          "api_key_cap_reached",
          "api_key_already_revoked",
          "api_key_revoked",
          "api_key_expired",
          "public_api_field_not_allowed",
          "public_api_unknown_field",
          "public_api_unknown_parameter",
          "public_api_body_too_large",
          "api_key_warehouse_needs_admin",
          "connection_schedule_shape",
          "connection_schedule_too_frequent",
          "connection_time_zone_unknown",
          "connection_target_required",
          "connection_target_not_allowed",
          "connection_target_not_on_ledger",
          "connection_unsupported_provider",
          "connection_not_ready",
          "connection_ends_on_passed",
          "connection_schedule_not_set",
          "connection_not_stopped",
          "connection_not_a_bank_feed",
          "connection_suggestion_decided",
          "connection_seat_cannot_administer",
          "connection_company_required",
          "connection_suggestion_required",
          "connection_ledger_not_found",
          "connection_history_seat",
          "connection_history_page_size",
          "connection_history_trigger",
          "connection_history_cursor",
          "places_identity_missing",
          "places_not_permitted",
          "places_unavailable",
          "place_not_found",
          "itc_window_not_gst",
          "itc_window_year_unknown",
          "itc_window_year_future",
          "itc_window_already",
          "return_itc_support_not_gst34",
          "return_itc_support_export_too_many",
          "invoice_selection_stale",
          "invoice_documents_overrun",
          "contract_po_needs_approver",
          "grant_read_only",
          "grant_no_deletes",
          "banking_agent_refused",
          "banking_needs_web_app",
          "proposal_not_pending",
          "proposal_expired",
          "proposal_on_its_desk",
          "proposal_awaits_confirmation",
          "proposal_contract_changed",
          "proposal_declined_recently",
          "proposal_input_invalid",
          "proposal_input_sensitive",
          "operation_not_served_here",
          "undo_group_not_yours",
          "undo_group_closed",
          "test_copy_outbound_off",
          "test_copy_replaced",
          "test_copy_exists",
          "test_copy_of_copy",
          "test_copy_not_found",
          "test_copy_too_large",
          "test_copy_not_switchable",
          "test_copy_busy",
          "test_copy_base_missing",
          "promotion_too_large",
          "promotion_conflicted",
          "promotion_unresolved",
          "outbound_guard_belt",
          "operation_replay_only",
          "invitation_request_reused",
          "undo_group_required",
          "approval_needs_person",
          "operation_audit_facts",
          "model_read_facts_moved",
          "operation_call_timed_out",
          "operation_facts_moved",
          "operation_settling",
          "position_ahead_of_ledger",
          "job_not_started",
          "job_message_unreadable",
          "answer_unreadable",
          "resource_required",
          "consent_request_invalid",
          "two_factor_required",
          "two_factor_not_enrolled",
          "two_factor_code_wrong",
          "two_factor_locked",
          "grant_ledgers_empty",
          "grant_ledger_unavailable",
          "connected_app_not_found",
          "connected_app_already_revoked",
          "connected_apps_off",
          "connected_app_not_verified",
          "consent_incomplete",
          "intercompany_elimination_blocked_future",
          "intercompany_elimination_blocked_not_matched",
          "intercompany_elimination_blocked_currency",
          "intercompany_elimination_blocked_fiscal_year",
          "intercompany_elimination_blocked_not_posted",
          "intercompany_elimination_blocked_not_plain",
          "intercompany_elimination_blocked_open_differs",
          "intercompany_elimination_blocked_nothing_to_eliminate",
          "intercompany_void_needs_reason",
          "slip_copy_document_mismatch",
          "search_source_erased",
          "search_source_not_found",
          "search_source_not_failed",
          "search_query_empty",
          "search_unavailable",
          "redaction_unavailable",
          "parser_unavailable",
          "parser_refused",
          "ocr_unavailable",
          "embedding_unavailable",
          "assistant_rate_limited",
          "assistant_turn_running",
          "assistant_turn_ended",
          "assistant_confirmation_pending",
          "assistant_not_connected",
          "assistant_already_connected",
          "assistant_ticket_invalid",
          "assistant_ticket_expired",
          "assistant_turn_not_found",
          "assistant_model_unavailable",
          "erasure_request",
          "model_named",
          "figure_unread",
          "contact_detail",
          "web_address",
          "citation_unread",
          "ledger_required",
          "grant_ledger_excluded",
          "confirmation_not_yours",
          "program_limit_exceeded",
          "program_halted",
          "request_state_invalid",
          "undo_group_undone",
          "warehouse_not_configured",
          "warehouse_kind_unknown",
          "warehouse_target_invalid",
          "warehouse_destination_cap",
          "warehouse_target_taken",
          "warehouse_not_tested",
          "warehouse_residency_unacknowledged",
          "warehouse_destination_removed",
          "warehouse_wrong_state",
          "warehouse_credential_not_rotatable",
          "warehouse_backfill_running",
          "warehouse_writer_unavailable",
          "warehouse_setup_not_described",
          "job_not_found",
          "job_finished",
          "job_not_resumable",
          "job_already_open",
          "job_cancel_not_allowed",
          "job_cancel_reason_required",
          "job_step_failed",
          "job_stalled",
          "job_seat_revoked",
          "job_grant_revoked",
          "provider_token_refreshing",
          "bulk_operation_class_refused",
          "bulk_operation_not_idempotent",
          "bulk_operation_not_served",
          "bulk_operation_too_large",
          "bulk_operation_item_too_large",
          "bulk_operation_unknown",
          "bulk_operation_not_undoable",
          "job_not_pausable",
          "job_paused",
          "job_not_reinstatable",
          "undo_group_not_undone",
          "undo_outside_batch",
          "restore_only_through_undo",
          "undo_authority_revoked",
          "undo_authority_unknown",
          "record_import_not_found",
          "record_import_not_applying",
          "record_import_seat_narrowed",
          "close_not_ready",
          "chart_import_clash",
          "csv_import_too_many_rows",
          "custom_field_limit_reached",
          "custom_field_index_limit_reached",
          "custom_object_limit_reached",
          "custom_object_archived",
          "custom_key_taken",
          "custom_field_not_indexed",
          "custom_field_index_building",
          "custom_reference_not_found",
          "custom_record_changed",
          "dimension_type_limit_reached",
          "dimension_type_system",
          "validation_rule_limit_reached",
          "validation_rule_invalid",
          "validation_rule_failed",
          "record_labels_too_many",
          "custom_field_type_not_on_lines",
          "custom_field_line_not_indexable",
          "custom_field_print_limit_reached",
          "invalid_custom_field",
          "entry_posted",
          "operation_sunset",
          "idempotency_key_required",
          "api_access_not_enabled",
          "api_access_ledger_closed",
          "api_key_maker_left",
          "workflow_definition_invalid",
          "workflow_action_not_offered",
          "workflow_action_banking",
          "workflow_action_person_only",
          "workflow_proposal_not_last",
          "workflow_limit_reached",
          "workflow_expiry_invalid",
          "workflow_preview_required",
          "workflow_needs_second_admin",
          "workflow_owner_lacks_capability",
          "workflow_version_changed",
          "workflow_activation_needs_person",
          "workflow_not_active",
          "workflow_paused",
          "workflow_expired",
          "workflow_draft_missing",
          "approval_step_same_person",
          "approval_vote_twice",
          "rule_routing_moved",
          "rule_auto_approval_web_only",
          "workflow_run_banking_refused",
          "query_not_a_select",
          "query_multiple_statements",
          "query_syntax",
          "query_view_unknown",
          "query_view_not_permitted",
          "query_function_not_allowed",
          "query_construct_not_allowed",
          "query_duplicate_column",
          "query_too_large",
          "query_too_costly",
          "query_timed_out",
          "query_write_refused",
          "query_busy",
          "query_needs_order_for_paging",
          "query_offset_too_large",
          "query_cursor_mismatch",
          "analysis_scope_tampered",
          "analysis_deparse_mismatch",
          "measure_unknown",
          "dimension_unknown",
          "measure_dimension_unreachable",
          "measure_mixed_currency",
          "measure_point_in_time",
          "saved_query_changed",
          "saved_query_limit_reached",
          "saved_query_archived",
          "dimension_value_merge_type",
          "dimension_value_merge_target_merged",
          "dimension_value_merge_self",
          "dimension_value_has_children",
          "dimension_value_not_merged",
          "dimension_value_already_merged",
          "tenant_moving",
          "tenant_unavailable",
          "inbound_address_taken",
          "inbound_domain_taken",
          "vendor_export_too_many",
          "vendor_name_no_letters",
          "vendor_same_supplier",
          "vendor_default_account_not_on_ledger",
          "terms_not_on_ledger",
          "terms_not_for_purchases",
          "terms_days_no_set",
          "terms_days_ambiguous",
          "vendor_company_not_on_ledger",
          "vendor_owner_not_on_ledger",
          "vendor_counterparty_entity_taken",
          "banking_change_already_open",
          "vendor_second_remittance_contact",
          "vendor_archived_closed",
          "vendor_already_archived",
          "vendor_archive_banking_open",
          "vendor_not_archived",
          "vendor_hold_on_archived",
          "vendor_already_held",
          "vendor_not_held",
          "banking_evidence_not_on_ledger",
          "banking_vendor_archived",
          "banking_account_shared",
          "banking_change_already_decided",
          "banking_change_decided_meanwhile",
          "banking_change_frozen",
          "banking_change_not_in_force",
          "banking_decide_own_proposal",
          "banking_withdraw_not_yours",
          "banking_notice_moved",
          "banking_evidence_too_large",
          "banking_notice_not_owed",
          "banking_notice_already_recorded",
          "vendor_contact_remittance_needs_email",
          "vendor_contact_unreachable",
          "vendor_contact_email_role_taken",
          "vendor_contacts_full",
          "vendor_contact_unchanged",
          "purchases_cursor_unknown",
          "vendor_accept_own",
          "vendor_accept_archived",
          "vendor_already_accepted",
          "vendor_refuse_accepted",
          "vendor_refuse_already_decided",
          "banking_same_hand",
          "purchases_verification_method_not_offered",
          "purchases_payable_account_not_liability",
          "purchases_self_approved_export_too_many",
          "bill_export_too_many",
          "bill_vendor_not_on_ledger",
          "bill_vendor_archived",
          "bill_supplier_unnamed",
          "bill_due_before_bill_date",
          "bill_payable_not_on_chart",
          "bill_payable_not_liability",
          "bill_document_not_on_ledger",
          "bill_document_not_viewable",
          "bill_document_missing",
          "bill_document_stand_in",
          "bill_document_wrong_kind",
          "bill_document_inbox_keeps",
          "bill_lines_no_revisions",
          "bill_revision_unknown",
          "bill_line_price_mismatch",
          "bill_own_work_no_ceiling",
          "bill_own_work_over_ceiling",
          "bill_over_approval_ceiling",
          "bill_submit_blocked",
          "bill_decision_unknown",
          "bill_edit_blocked",
          "bill_import_number_required",
          "bill_import_company_gone",
          "bill_import_finding",
          "bill_import_duplicate",
          "bill_duplicate_stopped",
          "bill_not_found",
          "bill_not_awaiting_decision",
          "bill_decided_from_entry",
          "bill_approval_already_decided",
          "bill_cannot_post",
          "bill_line_uncoded",
          "bill_line_tax_changed",
          "bill_total_changed",
          "bill_draft_save_not_draft",
          "bill_edit_payload_unreadable",
          "bill_edit_not_posted",
          "bill_edit_already_pending",
          "bill_edit_payment_pinned",
          "bill_edit_none_pending",
          "bill_edit_own_proposal",
          "bill_edit_stale",
          "bill_edit_no_entry",
          "bill_legacy_changed",
          "bill_legacy_state",
          "bill_payment_changed",
          "bill_not_payable",
          "bill_changed",
          "bill_submit_not_draft",
          "bill_incomplete",
          "bill_number_used",
          "bill_void_not_posted",
          "bill_already_void",
          "bill_void_payment_blocked",
          "bill_void_edit_pending",
          "bill_void_no_entry",
          "bill_discard_not_draft",
          "payment_account_currency_not_in_file",
          "payment_originator_not_bank",
          "payment_run_export_too_many",
          "payment_date_too_far_ahead",
          "payment_date_too_far_back",
          "payment_run_account_not_company_bank",
          "payment_run_account_no_originator",
          "payment_run_bills_refused",
          "payment_run_bill_taken",
          "payment_run_allocation_moved",
          "payment_run_moved_meanwhile",
          "payment_run_payment_moved",
          "payment_run_release_own",
          "payment_run_not_draft",
          "payment_run_callback_unconfirmed",
          "payment_run_callback_unknown",
          "payment_run_no_rate",
          "payment_run_vendors_not_accepted",
          "payment_run_vendors_held",
          "payment_run_banking_moved",
          "payment_allocation_no_bill",
          "payment_bill_no_longer_owed",
          "payment_bill_entry_moved",
          "payment_bill_payable_lines",
          "payment_bill_payable_differs",
          "payment_run_cannot_cancel",
          "payment_run_cannot_reverse",
          "payment_run_no_entries",
          "payment_run_already_reversed",
          "payment_run_no_file",
          "payment_run_over_ceiling",
          "inbox_read_flag_not_open",
          "inbox_read_not_this_document",
          "inbox_read_already_read",
          "inbox_read_would_not_change",
          "inbox_read_attempts_used",
          "inbox_arrival_invoices_not_ours",
          "inbox_arrival_owned_by_bill",
          "inbox_arrival_at_the_desk",
          "inbox_arrival_already_decided",
          "inbox_arrival_sent_to_reader",
          "inbox_arrival_nothing_to_read",
          "inbox_arrival_type_not_readable",
          "inbox_arrival_already_read",
          "inbox_arrival_still_being_read",
          "inbox_arrivals_export_too_many",
          "inbox_refusals_export_too_many",
          "inbox_documents_export_too_many",
          "inbox_reply_stop_exists",
          "inbox_reply_stop_already_lifted",
          "inbox_replies_address_revoked",
          "inbox_replies_invoices_address",
          "inbox_replies_no_contact",
          "inbox_replies_until_out_of_range",
          "inbox_replies_already_off",
          "inbox_address_export_too_many",
          "inbox_address_mint_collided",
          "inbox_address_already_revoked",
          "inbox_address_vendor_archived",
          "inbox_address_watcher_no_seat",
          "inbox_address_telephone_required",
          "inbox_address_watcher_moved",
          "inbox_address_watcher_unchanged",
          "inbox_address_revoked_final",
          "inbox_address_binding_fixed",
          "inbox_address_invoices_not_bound",
          "inbox_address_suggestion_changed",
          "inbox_address_not_waiting",
          "inbox_address_no_suggestion",
          "vendor_notice_export_too_many",
          "vendor_notice_already_sent",
          "vendor_notice_withheld",
          "vendor_notice_draft_names_nobody",
          "vendor_notice_outbound_not_approved",
          "vendor_notice_recipient_stopped",
          "vendor_notice_recipient_bounced",
          "vendor_notice_relay_refused",
          "vendor_notice_vendor_archived",
          "vendor_notice_vendor_refused",
          "vendor_notice_address_unusable",
          "vendor_notice_recipient_not_on_record",
          "vendor_notice_no_email",
          "vendor_notice_no_contact",
          "vendor_notice_draft_open",
          "vendor_notice_not_drafted",
          "vendor_notice_paragraph_contact_detail",
          "vendor_notice_paragraph_banking",
          "bill_no_authority",
          "bill_outside_authority",
          "bill_authority_expired",
          "payment_run_no_authority",
          "payment_run_outside_authority",
          "payment_run_authority_expired",
          "authority_self_set",
          "authority_not_approver",
          "authority_scope_not_on_ledger",
          "authority_currency_not_company",
          "authority_own_work_above_cap",
          "authority_run_scope",
          "authority_expiry_out_of_range",
          "authority_already_open",
          "authority_closed",
          "authority_nothing_changed",
          "authority_carried_over_none",
          "authority_as_at_future",
          "authority_export_too_many",
          "bill_not_on_your_desk",
          "bill_stage_same_person",
          "bill_desk_not_waiting",
          "bill_desk_reassign_not_yours",
          "bill_desk_reassign_no_seat",
          "bill_desk_reassign_preparer",
          "bill_desk_reassign_no_authority",
          "bill_desk_reassign_same",
          "bill_desk_reassign_reviewer",
          "bill_awaiting_with_view",
          "bill_awaiting_too_many",
          "bill_approval_stage_export_too_many",
          "purchases_substitute_not_yours",
          "purchases_substitute_self",
          "purchases_substitute_no_seat",
          "purchases_substitute_too_long",
          "purchases_substitute_in_past",
          "purchases_substitute_overlap",
          "purchases_substitute_ended",
          "purchases_routing_desk_not_for_entries",
          "purchases_routing_author_no_authority",
          "purchases_policy_preview_needed",
          "purchases_policy_confirm_not_author",
          "purchases_policy_expiry_too_far",
          "purchases_policy_expiry_past",
          "purchases_policy_turn_on_by_confirm",
          "payment_originator_change_open",
          "payment_originator_same_as_in_force",
          "payment_originator_evidence_not_on_ledger",
          "payment_originator_decide_own_proposal",
          "payment_originator_change_already_decided",
          "payment_originator_change_decided_meanwhile",
          "payment_originator_withdraw_not_yours",
          "payment_run_originator_unverified",
          "payment_run_release_not_recorded",
          "bill_own_work_not_recorded",
          "payment_run_file_store_unavailable",
          "payment_run_file_missing",
          "payment_run_file_changed",
          "payment_run_file_stand_in",
          "full_export_own_request",
          "full_export_sole_admin",
          "full_export_override_not_sole",
          "full_export_override_not_owner",
          "full_export_already_decided",
          "full_export_decision_window_passed",
          "full_export_bank_files_not_confirmed",
          "full_export_bank_files_web_only",
          "full_export_not_approved",
          "full_export_not_yours",
          "full_export_already_downloaded",
          "full_export_download_window_passed",
          "full_export_not_requester",
          "full_export_list_too_many",
          "full_export_not_ready",
          "full_export_build_failed",
          "full_export_build_cancelled",
          "signal_already_decided",
          "signal_dismiss_own_work",
          "signal_export_too_many",
          "signal_decided_by_banking_change",
          "banking_signals_changed",
          "banking_reject_signal_not_fired",
          "vendor_sender_domain_already_retired",
          "vendor_sender_domain_not_retired",
          "bill_hold_not_payable",
          "bill_already_held",
          "bill_not_held",
          "bill_hold_until_past",
          "bill_hold_until_too_far",
          "payment_run_bills_held",
          "payment_run_bill_held_meanwhile",
          "bill_settlement_not_owed",
          "bill_settlement_in_draft_run",
          "bill_settlement_amount_moved",
          "bill_settlement_future_date",
          "bill_settlement_account_not_company",
          "bill_settlement_currency",
          "bill_settlement_paid_amount_required",
          "bill_settlement_method_not_recordable",
          "bill_settlement_no_open_period",
          "bill_settlement_payable_lines",
          "bill_settlement_payable_differs",
          "bill_settlement_same_person",
          "bill_settlement_over_ceiling",
          "bill_settlement_held",
          "bill_settlement_not_awaiting",
          "bill_settlement_run_owned",
          "bill_settlement_void_period_closed",
          "bill_paid_by_in_draft",
          "bill_paid_by_closed",
          "bill_paid_by_in_run",
          "bill_paid_by_recorded",
          "bill_still_owed_not_listed",
          "bill_paid_by_at_review",
          "bill_edit_paid_by",
          "purchases_as_of_future",
          "purchases_ageing_too_many_bills",
          "purchases_ageing_export_too_many",
          "purchases_report_unknown",
          "purchases_report_filter_not_taken",
          "purchases_report_status_unknown",
          "purchases_report_needs_company",
          "purchases_report_needs_dimension",
          "purchases_report_needs_slip_kind",
          "purchases_report_no_registration",
          "purchases_report_range_too_long",
          "purchases_report_controls_seat",
          "purchases_report_export_too_many",
          "purchases_report_working_set",
          "purchases_report_view_limit",
          "purchases_report_view_name_taken",
          "payment_run_reversal_not_recorded",
          "purchases_fx_method_recent",
          "bill_fx_not_foreign",
          "bill_fx_not_posted",
          "bill_fx_already_stated",
          "bill_fx_rate_date_future",
          "bill_itc_statement_void",
          "bill_itc_statement_not_claimed",
          "bill_itc_statement_stale",
          "vendor_registration_no_number",
          "vendor_registration_number_changed",
          "vendor_registration_date_future",
          "vendor_registration_evidence_not_found",
          "vendor_registration_evidence_too_large",
          "vendor_registration_evidence_missing",
          "vendor_registration_evidence_stand_in",
          "vendor_registration_state_checked",
          "bill_posting_date_required",
          "bill_posting_date_outside",
          "bill_posting_date_not_moved",
          "bill_posting_no_open_period",
          "bill_posting_date_not_recorded",
          "bill_posting_date_at_review",
          "payment_run_bill_owed_moved",
          "payment_bill_owed_moved",
          "bill_settlement_more_than_owed",
          "bill_settlement_short_without_reason",
          "vendor_credit_not_draft",
          "vendor_credit_no_vendor",
          "vendor_credit_incomplete",
          "vendor_credit_nothing_credited",
          "vendor_credit_number_used",
          "vendor_credit_date_future",
          "vendor_credit_vendor_archived",
          "vendor_credit_not_in_review",
          "vendor_credit_same_person",
          "vendor_credit_pricing_moved",
          "vendor_credit_posting_date_required",
          "vendor_credit_posting_date_outside",
          "vendor_credit_posting_date_not_moved",
          "vendor_credit_no_open_period",
          "vendor_credit_not_open",
          "vendor_credit_bill_other_vendor",
          "vendor_credit_bill_other_company",
          "vendor_credit_bill_currency",
          "vendor_credit_bill_not_owing",
          "vendor_credit_bill_in_draft_run",
          "vendor_credit_payable_differs",
          "vendor_credit_bill_over_open",
          "vendor_credit_over_remaining",
          "vendor_credit_already_applied",
          "vendor_credit_exchange_account_missing",
          "vendor_credit_application_in_run",
          "vendor_credit_application_not_live",
          "vendor_credit_not_approved",
          "vendor_credit_has_applications",
          "vendor_credit_has_refunds",
          "vendor_credit_refund_future_date",
          "vendor_credit_refund_account_not_company",
          "vendor_credit_refund_amount_required",
          "vendor_credit_refund_over_remaining",
          "vendor_credit_refund_not_awaiting",
          "vendor_credit_refund_not_standing",
          "vendor_credit_refund_same_person",
          "vendor_credit_export_too_many",
          "payment_run_credit_not_open",
          "payment_run_credit_other_vendor",
          "payment_run_credit_over_open",
          "payment_run_credit_covers_bill",
          "bill_supersede_not_draft",
          "bill_supersede_self",
          "bill_supersede_target_unknown",
          "bill_supersede_target_draft",
          "bill_supersede_other_company",
          "bill_supersede_no_vendor",
          "bill_supersede_other_vendor",
          "bill_supersede_taken",
          "bill_supersede_already_linked",
          "bill_supersede_not_linked",
          "bill_supersede_first_stands",
          "bill_supersede_flag_settled",
          "bill_supersede_flag_not_this",
          "payment_run_cheque_number_required",
          "payment_run_cheque_number_not_asked",
          "payment_run_cheque_number_range",
          "payment_run_cheque_number_taken",
          "payment_run_register_not_cheque",
          "payment_run_register_not_released",
          "bill_settlement_line_not_a_candidate",
          "bill_settlement_line_declined",
          "bill_settlement_feed_score_moved",
          "bill_settlement_line_taken",
          "bill_settlement_line_certified",
          "bill_feed_line_not_a_candidate",
          "payment_discount_changed",
          "payment_discount_window_closed",
          "payment_discount_account_type",
          "payment_run_remove_not_draft",
          "payment_run_remove_last",
          "payment_run_payment_already_removed",
          "payment_reverse_not_released",
          "payment_removed_never_posted",
          "payment_already_reversed",
          "payment_reverse_file_rejected",
          "payment_return_date_invalid",
          "payment_run_notice_document_invalid",
          "payment_run_lodgement_not_released",
          "payment_run_lodgement_recorded",
          "payment_run_lodgement_reversed",
          "payment_run_lodgement_date_invalid",
          "payment_run_outcome_not_lodged",
          "payment_run_outcome_recorded",
          "payment_run_outcome_accepted_reversed",
          "payment_run_outcome_after_return",
          "payment_run_outcome_date_invalid",
          "payment_run_banking_returned",
          "payment_run_banking_returned_meanwhile",
          "payment_run_totals_not_recorded",
          "payment_run_lodgement_cheque",
          "payment_run_bills_twin_paid",
          "bill_settlement_line_not_a_bill",
          "bill_settlement_line_amount_differs",
          "payment_run_clearing_disagrees",
          "payment_bank_profile_no_originator",
          "payment_bank_profile_exists",
          "payment_bank_profile_uncited",
          "payment_bank_profile_changed",
          "payment_run_test_not_draft",
          "payment_run_test_no_profile",
          "payment_run_test_check_failed",
          "payment_bank_file_verdict_recorded",
          "payment_bank_file_verdict_no_evidence",
          "payment_bank_file_evidence_not_on_ledger",
          "payment_bank_file_tests_export_too_many",
          "payment_run_bank_file_unproved",
          "payment_run_bank_date_window",
          "payment_run_bank_currency_refused",
          "payment_run_test_not_eft",
          "vendor_notice_remittance_run_not_released",
          "vendor_notice_remittance_not_sender",
          "vendor_notice_remittance_needs_second_person",
          "vendor_notice_remittance_new_address_needs_person",
          "vendor_notice_remittance_confirm_not_new",
          "vendor_notice_remittance_exists",
          "vendor_notice_remittance_payment_reversed",
          "vendor_notice_remittance_from_run",
          "vendor_notice_remittance_paragraph_contact_detail",
          "vendor_notice_remittance_paragraph_banking",
          "vendor_notice_remittance_paragraph_promise",
          "vendor_notice_bill_no_supplier",
          "vendor_notice_decision_not_made",
          "vendor_notice_no_supplier_contact",
          "vendor_notice_supplier_contact_no_seat",
          "vendor_notice_decision_draft_open",
          "vendor_notice_already_told",
          "vendor_notice_nothing_to_ask",
          "vendor_notice_words_decision",
          "vendor_notice_words_contact_detail",
          "vendor_notice_words_banking",
          "vendor_notice_banking_no_earlier_contact",
          "vendor_notice_recipient_after_change",
          "vendor_notice_not_person_drafted",
          "inbox_address_closing_out_of_range",
          "inbox_address_closing_scheduled",
          "inbox_address_closing_not_scheduled",
          "inbox_address_successor_unusable",
          "purchases_supplier_contact_no_seat",
          "inbox_address_closing_not_announced",
          "vendor_notice_supplier_contact_bills_address",
          "inbox_arrival_owned_by_credit",
          "vendor_credit_refund_currency",
          "vendor_credit_line_other_bill",
          "bill_settlement_evidence_unreadable",
          "bill_feed_line_no_supplier",
          "payment_run_bank_notice_too_large",
          "payment_run_wire_abroad_unreadable",
          "bill_supersede_prefill_too_many_lines",
          "bill_supersede_prefill_no_lines",
          "vendor_document_not_paper",
          "vendor_document_already_filed",
          "vendor_document_title",
          "vendor_document_dates",
          "vendor_document_expiry_too_far",
          "vendor_document_replaces_other_kind",
          "vendor_document_already_replaced",
          "vendor_document_already_withdrawn",
          "vendor_document_waiver_in_force",
          "vendor_document_without_terms_kind",
          "vendor_paper_cap",
          "vendor_paper_file_missing",
          "vendor_paper_file_stand_in",
          "vendor_agreement_term",
          "vendor_agreement_dates",
          "vendor_agreement_notice",
          "vendor_agreement_committed",
          "vendor_agreement_copy_not_theirs",
          "vendor_agreement_already_renewed",
          "vendor_agreement_not_your_decision",
          "vendor_agreement_closed",
          "vendor_paper_notice_no_recipient",
          "vendor_paper_notice_nothing_to_ask",
          "vendor_paper_notice_open_draft",
          "vendor_paper_notice_not_deciding_to_end",
          "vendor_paper_notice_needs_agreement",
          "vendor_paper_notice_names_no_agreement",
          "paper_requirements_count_moved",
          "paper_requirements_too_many",
          "paper_requirements_no_kind",
          "vendor_alias_key_taken",
          "vendor_alias_is_own_name",
          "vendor_alias_limit",
          "vendor_merged_not_restorable",
          "vendor_link_changed",
          "vendor_link_posted_needs_approver",
          "vendor_link_nothing",
          "vendor_merge_same_record",
          "vendor_merge_absorbed_archived",
          "vendor_merge_survivor_archived",
          "vendor_merge_absorbed_refused",
          "vendor_merge_survivor_refused",
          "vendor_merge_banking_open",
          "vendor_merge_banking_differs",
          "vendor_merge_hold_would_lift",
          "vendor_merge_in_draft_run",
          "vendor_merge_bills_in_review",
          "vendor_merge_open_credit",
          "vendor_merge_authority_scope",
          "vendor_merge_counterparty",
          "vendor_merge_slip_kind_differs",
          "vendor_merge_residency_differs",
          "vendor_merge_slip_consent_both_live",
          "vendor_merge_paper_over_cap",
          "vendor_merge_already_open",
          "vendor_merge_survivor_is_absorbed",
          "vendor_merge_same_hand",
          "vendor_merge_expired",
          "vendor_merge_decided",
          "vendor_merge_changed",
          "vendor_merge_withdraw_not_proposer",
          "vendor_merge_export_too_many",
          "vendor_merge_suggestion_dismissed",
          "vendor_merge_suggestion_reinstated",
          "bill_vendor_merged",
          "bill_link_vendor_in_review",
          "bill_link_vendor_void",
          "bill_link_vendor_posted_has_vendor",
          "supplier_match_decided",
          "bill_supplier_match_other_supplier",
          "slip_copies_file_not_kept",
          "slip_copies_print_too_many",
          "slip_copies_print_none",
          "slip_copy_document_not_stored",
          "slip_copy_export_too_many",
          "slip_copies_mailed_set_changed",
          "slip_copies_mailed_not_waiting",
          "slip_copies_mailed_future",
          "slip_consent_no_email",
          "slip_consent_already_live",
          "slip_consent_future",
          "slip_consent_not_given",
          "slip_copy_email_no_consent",
          "slip_copy_from_copies",
          "slip_copy_notice_by_hand",
          "slip_identity_ask_nothing_missing",
          "slip_identity_ask_recent",
          "bill_withholding_status",
          "bill_withholding_vendor_residency",
          "bill_withholding_withheld_on",
          "bill_withholding_changed",
          "bill_withholding_line_not_current",
          "bill_withholding_line_not_service",
          "bill_withholding_whole_bill_has_lines",
          "withholding_waiver_vendor",
          "withholding_waiver_document",
          "withholding_waiver_company",
          "withholding_waiver_already_recorded",
          "withholding_waiver_already_ended",
          "withholding_waiver_end_date",
          "purchases_withholding_account_not_liability",
          "vendor_slip_non_resident",
          "vendor_residency_has_nr_slip",
          "payment_withholding_moved",
          "payment_withholding_account_moved",
          "inbox_controls_sender_above_address",
          "inbox_arrival_held",
          "inbox_hold_not_held",
          "inbox_controls_export_too_many",
          "inbox_controls_firings_filters",
          "payment_run_marks_unconfirmed",
          "payment_run_marks_unknown",
          "payment_run_marks_not_recorded",
          "payment_run_brief_not_draft",
          "bill_dimension_value_unknown",
          "bill_proposed_tag_not_on_line",
          "bill_dimension_not_recorded",
          "bill_budget_changed",
          "bill_budget_not_open",
          "seat_company_outside",
          "seat_company_all_needed",
          "seat_company_person_not_covering",
          "seat_company_policy_wide",
          "seat_company_unclassified",
          "seat_company_report_needs_one",
          "seat_company_not_on_ledger",
          "seat_company_ledger_mismatch",
          "purchase_order_not_found",
          "purchase_order_not_draft",
          "purchase_order_empty_patch",
          "purchase_order_incomplete",
          "purchase_order_vendor_unusable",
          "purchase_order_asked_not_covered",
          "purchase_order_fx_no_rate",
          "purchase_order_fx_not_foreign",
          "purchase_order_dimension_misfiled",
          "purchase_order_awaiting_with_status",
          "purchase_order_changed",
          "purchase_order_not_in_approval",
          "purchase_order_no_authority",
          "purchase_order_outside_authority",
          "purchase_order_authority_expired",
          "purchase_order_over_approval_ceiling",
          "purchase_order_own_work_no_ceiling",
          "purchase_order_cannot_take_back",
          "purchase_order_take_back_seat",
          "purchase_order_notice_open",
          "purchase_order_not_sent",
          "purchase_order_cancel_seat",
          "purchase_order_cancelled",
          "purchase_order_not_approved_to_send",
          "purchase_order_already_sent",
          "purchase_order_no_recipient",
          "purchase_order_recipient_unknown",
          "purchase_order_not_cancelled",
          "purchase_order_series_next_lower",
          "purchase_order_export_too_many",
          "purchase_order_quote_document_not_quote",
          "purchase_order_suggestion_gone",
          "goods_receipt_not_found",
          "purchase_order_not_receivable",
          "goods_receipt_incomplete",
          "goods_receipt_over_receipt",
          "goods_receipt_future_date",
          "goods_receipt_before_order",
          "goods_receipt_receiver_is_approver",
          "goods_receipt_service_requester_only",
          "goods_receipt_on_behalf_seat",
          "goods_receipt_on_behalf_note",
          "goods_receipt_order_changed",
          "goods_receipt_not_proposed",
          "goods_receipt_not_confirmed",
          "goods_receipt_void_seat",
          "goods_receipt_billed",
          "goods_receipt_evidence_limit",
          "goods_receipt_evidence_kind",
          "goods_receipt_evidence_not_attached",
          "goods_receipt_attach_not_live",
          "goods_receipt_withdraw_seat",
          "purchase_order_cancel_after_receipt",
          "purchase_order_amend_after_receipt",
          "purchase_order_cannot_close",
          "purchase_order_close_seat",
          "purchase_order_not_closed",
          "bill_order_link_not_open",
          "bill_order_line_wrong_company",
          "bill_order_line_wrong_supplier",
          "bill_order_line_not_open",
          "bill_order_link_not_recorded",
          "bill_order_link_no_line",
          "bill_order_link_duplicate_line",
          "bill_order_proposal_cleared_line",
          "bill_order_proposal_no_supplier",
          "bill_match_changed",
          "purchases_policy_tolerance_over_authority",
          "vendor_order_exemption_reason_required",
          "accrual_account_missing",
          "accrual_account_not_liability",
          "accrual_account_is_payable",
          "accrual_period_locked",
          "accrual_earlier_standing",
          "accrual_nothing_to_accrue",
          "accrual_standing_differs",
          "accrual_rate_missing",
          "accrual_too_many_lines",
          "expected_bills_month_in_future",
          "expected_bills_export_too_many",
          "accrual_no_signals",
          "accrual_bill_arrived",
          "accrual_already_drafted",
          "accrual_not_predicted",
          "schedule_follow_not_posted",
          "schedule_follow_other_schedule",
          "schedule_follow_inactive",
          "signal_scope_not_offered",
          "bill_prepaid_changed",
          "bill_prepaid_choice_missing",
          "bill_prepaid_not_open",
          "bill_prepaid_released",
          "bill_prepaid_line_locked",
          "prepaid_release_waiting",
          "prepaid_nothing_to_end",
          "prepaid_period_closed",
          "prepaid_not_active",
          "prepaid_destination_refused",
          "prepaid_account_type",
          "bill_holdback_too_large",
          "bill_holdback_amount_invalid",
          "bill_holdback_foreign_currency",
          "bill_holdback_account_missing",
          "bill_holdback_account_not_liability",
          "bill_holdback_account_is_payable",
          "bill_holdback_release_not_posted",
          "bill_holdback_release_exceeds",
          "bill_holdback_release_none_left",
          "bill_holdback_release_before_bill",
          "bill_holdback_release_future",
          "bill_holdback_edit_released",
          "bill_holdback_void_released",
          "bill_holdback_none_note_short",
          "purchases_settings_account_shared",
          "cutover_exists",
          "cutover_date_future",
          "cutover_date_before_incorporation",
          "cutover_suspense_type",
          "cutover_suspense_inactive",
          "cutover_suspense_is_payable",
          "cutover_go_live_documents",
          "cutover_go_live_owned",
          "cutover_settled_frozen",
          "cutover_already_settled",
          "cutover_withdrawn",
          "cutover_withdraw_date_moved",
          "cutover_withdraw_opening_entry",
          "cutover_opening_entry_company",
          "cutover_opening_entry_date",
          "cutover_opening_entry_status",
          "cutover_checks_failing",
          "cutover_checks_changed",
          "cutover_acknowledgement_unknown",
          "cutover_export_too_many",
          "open_payables_cutover_closed",
          "open_payables_wrong_company",
          "open_payables_uploader_posts",
          "open_payables_attestation_missing",
          "open_payables_rows_not_ready",
          "open_payables_count_changed",
          "open_payables_difference_unexplained",
          "open_payables_authority",
          "open_payables_period_locked",
          "open_payables_reverse_closed",
          "open_payables_already_reversed",
          "open_payables_reverse_blocked",
          "open_payables_bill_not_editable",
          "open_payables_bill_void_closed",
          "open_payables_cutover_has_postings",
          "parallel_run_payables_month_not_ended",
          "parallel_run_payables_not_addable",
          "parallel_run_payables_not_compared",
          "parallel_run_proposal_decided",
          "parallel_run_proposal_stale",
          "parallel_run_total_not_classified",
          "parallel_run_proposal_not_found",
          "parallel_run_month_past_line_ceiling",
          "banking_batch_not_yours",
          "banking_batch_file_format",
          "banking_batch_too_many",
          "banking_batch_secret_fill",
          "banking_batch_paper_limit",
          "banking_batch_paper_duplicate",
          "banking_batch_paper_closed",
          "banking_batch_check_nothing",
          "banking_batch_check_running",
          "banking_batch_filter_kind",
          "banking_batch_expired",
          "banking_batch_still_reading",
          "banking_paper_name_empty",
          "banking_paper_taken_off",
          "bill_payable_account_not_recorded",
          "payment_run_release_totals_not_recorded",
          "record_import_apply_running",
          "record_import_too_many_to_approve",
          "record_import_revert_refused",
          "record_import_revert_asset_standing",
          "record_import_revert_customer_waiting",
          "record_import_kind_web_only",
          "payment_run_release_timed_out",
          "list_sort_unknown",
          "list_sort_needs_company",
          "list_sort_unavailable",
          "bill_amount_needs_company",
          "purchases_cursor_other_order",
          "list_view_limit",
          "list_view_shared_limit",
          "list_view_name_taken",
          "list_view_params_not_taken",
          "list_view_share_needs_seat",
          "bulk_act_empty",
          "bulk_act_too_many",
          "bulk_act_reason_needed",
          "bulk_act_filter_not_taken",
          "bulk_act_filter_changed",
          "bulk_act_changed",
          "bulk_act_over_cap",
          "bulk_act_nothing_eligible",
          "bulk_act_wrong_mode",
          "bulk_item_not_found",
          "bulk_item_status",
          "bill_bulk_stage_is_review",
          "bill_bulk_no_rate",
          "bill_bulk_month_closed",
          "bill_bulk_over_budget",
          "bill_bulk_match_exception",
          "bill_bulk_prepaid_offered",
          "bill_bulk_findings",
          "bill_bulk_signal_open",
          "bill_bulk_not_draft",
          "bill_bulk_not_held",
          "vendor_bulk_already_held",
          "vendor_bulk_not_held",
          "payment_run_bulk_not_draft",
          "purchase_order_bulk_not_draft",
          "inbox_bulk_already_decided",
          "purchases_export_kind_unknown",
          "purchases_export_query_invalid",
          "purchases_export_open_limit",
          "purchases_export_all_needs_audit",
          "purchases_export_not_ready",
          "purchases_export_failed",
          "purchases_export_expired",
          "purchases_export_not_yours",
          "purchases_export_seat_changed",
          "purchases_export_object_missing",
          "privacy_received_out_of_range",
          "privacy_identity_note_needed",
          "privacy_not_an_individual",
          "privacy_duplicate_open",
          "privacy_change_in_force",
          "privacy_change_in_draft_run",
          "privacy_change_not_paid",
          "privacy_digits_already_destroyed",
          "privacy_permission_needed",
          "privacy_permission_voided",
          "privacy_permission_other_supplier",
          "privacy_permission_duplicate",
          "privacy_permission_used",
          "privacy_own_request",
          "privacy_not_waiting",
          "privacy_not_open",
          "privacy_plan_moved",
          "privacy_not_yours",
          "privacy_answer_before_decision",
          "privacy_already_answered",
          "privacy_pack_not_for_this_kind",
          "privacy_pack_not_asked",
          "privacy_pack_not_ready",
          "privacy_pack_build_failed",
          "privacy_pack_build_cancelled",
          "privacy_pack_gone",
          "privacy_admin_only",
          "privacy_message_too_long",
          "privacy_no_decision_for_copy",
          "privacy_export_too_many",
          "privacy_permission_letter_wrong_kind",
          "vendor_merge_privacy_request_open",
          "vendor_merge_portal_submission_waiting",
          "vendor_merge_vendor_query_open",
          "vendor_merge_vendor_statement_open",
          "year_end_file_year_end_invalid",
          "year_end_file_building",
          "year_end_file_not_building",
          "year_end_file_not_ready",
          "year_end_file_already_signed",
          "year_end_file_store_unavailable",
          "year_end_file_audit_seat",
          "year_end_file_commentary_figure",
          "year_end_file_decisions_incomplete",
          "year_end_commentary_attempts",
          "year_end_file_export_too_many",
          "vendor_portal_off",
          "vendor_portal_link_revoked",
          "vendor_portal_no_live_link",
          "vendor_portal_issuer_deciding",
          "vendor_portal_already_decided",
          "vendor_portal_record_moved",
          "vendor_portal_submission_kind",
          "vendor_portal_evidence_mismatch",
          "vendor_portal_closed",
          "vendor_portal_facts_empty",
          "vendor_portal_facts_waiting",
          "vendor_portal_banking_waiting",
          "vendor_portal_digits_not_here",
          "vendor_portal_paper_kind",
          "vendor_portal_cap",
          "vendor_portal_daily_limit",
          "vendor_portal_no_company",
          "vendor_portal_file_too_large",
          "vendor_portal_file_empty",
          "vendor_portal_file_type",
          "vendor_portal_file_not_kept",
          "vendor_portal_not_withdrawable",
          "vendor_portal_link_mismatch",
          "vendor_query_closed",
          "vendor_query_moved_on",
          "vendor_query_already_resolved",
          "vendor_query_owner_no_seat",
          "vendor_query_assign_not_yours",
          "vendor_query_subject_other_supplier",
          "vendor_query_vendor_archived",
          "vendor_query_arrival_not_a_message",
          "vendor_query_arrival_already_opened",
          "vendor_query_arrival_supplier_needed",
          "vendor_query_fact_not_available",
          "vendor_query_answer_empty",
          "vendor_notice_invitation_needs_link",
          "vendor_notice_link_not_invitation",
          "vendor_portal_company_needed",
          "vendor_portal_owner_unavailable",
          "vendor_portal_query_closed",
          "vendor_query_arrival_text_unreadable",
          "vendor_query_policy_expires_past",
          "vendor_query_no_company_reachable",
          "vendor_query_message_other_supplier",
          "vendor_query_arrival_quoted_only",
          "vendor_query_internal_question_not_open",
          "vendor_statement_database_refused",
          "vendor_query_portal_duplicate",
          "vendor_query_portal_open_cap",
          "vendor_query_portal_message_cap",
          "vendor_query_policy_expiry",
          "vendor_query_policy_ended",
          "vendor_query_export_too_many",
          "vendor_query_set_aside_origin",
          "vendor_query_follow_up_open",
          "vendor_statement_not_found",
          "vendor_statement_exists",
          "vendor_statement_document_used",
          "vendor_statement_file_format",
          "vendor_statement_file_too_large",
          "vendor_statement_missing_date",
          "vendor_statement_too_many_lines",
          "vendor_statement_not_in_review",
          "vendor_statement_changed",
          "vendor_statement_books_moved",
          "vendor_statement_no_supplier",
          "vendor_statement_supplier_differs",
          "vendor_statement_unchecked_figures",
          "vendor_statement_missing_header",
          "vendor_statement_too_many_bills",
          "vendor_statement_link_invalid",
          "vendor_statement_decline_reason",
          "vendor_statement_read_in_progress",
          "vendor_statement_read_attempts_used",
          "vendor_statement_nothing_to_read",
          "vendor_statement_not_accepted",
          "vendor_statement_nothing_to_ask",
          "vendor_statement_discard_seat",
          "vendor_account_statement_not_tied",
          "vendor_account_statement_too_many_rows",
          "vendor_account_statement_too_many_to_draw",
          "bill_question_topic_open",
          "bill_question_bill_void",
          "bill_question_outcome_required",
          "bill_question_outcome_bill_only",
          "ai_ceiling_not_whole_cents",
          "ai_ceiling_too_high",
          "ai_ceiling_below_budget",
          "ai_budget_above_ledger",
          "ai_use_cursor_invalid",
          "ai_use_range_too_long",
          "ai_use_export_too_many",
          "bill_capital_bill_not_posted",
          "bill_capital_line_not_capital",
          "bill_capital_set_aside",
          "bill_capital_over_line",
          "bill_capital_entity_differs",
          "bill_capital_account_differs",
          "bill_capital_changed",
          "bill_capital_line_locked",
          "bill_capital_void_blocked",
          "bill_capital_read_off",
          "bill_capital_read_attempts_used",
          "bill_capital_read_not_open",
          "bill_capital_asset_already_linked",
          "bill_capital_asset_mismatch",
          "bill_capital_look_back_future",
          "signal_capital_set_aside_own_work",
          "signal_confirmed_by_registration",
          "purchases_line_profile_too_few_bills",
          "purchases_line_profile_field_not_agreed",
          "purchases_line_profile_pattern_moved",
          "purchases_line_profile_one_live",
          "purchases_line_profile_replaces_nothing",
          "purchases_line_profile_not_typed",
          "purchases_line_profile_account_not_active",
          "bill_plan_not_open",
          "bill_plan_date_past",
          "bill_plan_date_far",
          "bill_due_account_needs_company",
          "bill_due_account_invalid",
          "bulk_act_needs_date",
          "payment_plan_account_invalid",
          "payment_plan_vendor_unknown",
          "payment_plan_window_invalid",
          "payment_plan_nothing_to_plan",
          "payment_plan_expired",
          "payment_plan_already_decided",
          "payment_plan_changed",
          "payment_plan_line_unknown",
          "payment_plan_lines_open",
          "payment_plan_not_recorded",
          "payment_run_release_policy_author",
          "run_policy_account_taken",
          "run_policy_expiry_too_far",
          "run_policy_currency_differs",
          "run_policy_not_in_force",
          "run_policy_decline_needed",
          "run_policy_decline_suggestion",
          "run_policy_replace_invalid",
          "month_end_commentary_month_invalid",
          "month_end_commentary_draft_exists",
          "month_end_commentary_replaced",
          "month_end_commentary_race",
          "month_end_commentary_read_failed",
          "month_end_commentary_database_refused",
          "month_end_commentary_not_draft",
          "month_end_commentary_audit_seat",
          "month_end_commentary_sentence_figure",
          "month_end_commentary_decisions_incomplete",
          "month_end_commentary_nothing_kept",
          "month_end_commentary_attempts",
          "month_end_commentary_export_too_many",
          "imported_history_suppliers_unplaced",
          "imported_history_suppliers_not_offered",
          "migration_file_not_readable",
          "migration_file_wrong_kind",
          "migration_no_open_payables",
          "migration_too_many_files",
          "migration_reading_too_many",
          "migration_banking_needs_sensitive",
          "migration_month_signed",
          "migration_month_no_payables",
          "migration_month_company",
          "migration_month_before_conversion",
          "migration_assistant_not_for_lens",
          "migration_finding_decided",
          "migration_finding_not_proposal",
          "migration_finding_stale",
          "migration_class_not_allowed",
          "migration_change_needs",
          "migration_export_too_many",
          "webhook_signing_not_configured",
          "webhook_url_invalid",
          "webhook_url_not_https",
          "webhook_url_private",
          "webhook_url_has_query",
          "webhook_url_has_credentials",
          "webhook_url_port",
          "webhook_url_duplicate",
          "webhook_endpoint_limit",
          "webhook_event_unknown",
          "webhook_endpoint_not_active",
          "webhook_endpoint_removed",
          "webhook_secret_already_shown",
          "webhook_delivery_not_dead",
          "webhook_test_too_soon",
          "webhook_export_too_many",
          "card_receipt_export_too_many",
          "bill_also_record_needs_card",
          "bill_seen_total_changed",
          "bill_vendor_is_own_company",
          "vendor_counterparty_has_bills",
          "vendor_merge_counterparty_own_bills",
          "intercompany_other_company_not_in_seat",
          "intercompany_pair_decided",
          "intercompany_pair_not_open",
          "intercompany_candidate_taken",
          "intercompany_candidate_not_eligible",
          "intercompany_unlink_has_elimination",
          "intercompany_customer_needs_approval",
          "intercompany_customer_company_taken",
          "intercompany_mirror_line_not_billable",
          "intercompany_mirror_too_many_lines",
          "intercompany_account_not_revenue",
          "intercompany_figures_moved",
          "intercompany_decline_needs_reason",
          "intercompany_elimination_exists",
          "intercompany_elimination_already_void",
          "intercompany_by_hand_not_needed",
          "intercompany_by_hand_needs_note",
          "intercompany_elimination_groups_differ",
          "intercompany_reading_off",
          "intercompany_reading_limit",
          "intercompany_export_too_many",
          "intercompany_look_back_company_required",
          "inbox_domain_apex",
          "inbox_domain_platform",
          "inbox_domain_malformed",
          "inbox_domain_company_has_one",
          "inbox_domain_taken",
          "inbox_domain_unavailable",
          "inbox_domain_not_verified",
          "inbox_domain_local_part_reserved",
          "inbox_domain_address_taken",
          "inbox_domain_invoices_mailbox",
          "inbox_domain_company_mismatch",
          "inbox_domain_removed_final",
          "payment_rail_not_approved",
          "payment_rail_not_configured",
          "payment_rail_off",
          "payment_rail_no_connection",
          "payment_rail_connection_unavailable",
          "payment_rail_provider_unavailable",
          "payment_rail_funding_source_refused",
          "payment_rail_funding_source_in_use",
          "payment_rail_funding_source_not_bound",
          "payment_rail_already_set",
          "payment_rail_run_not_released",
          "payment_rail_method",
          "payment_rail_currency",
          "payment_rail_run_lodged",
          "payment_rail_already_dispatched",
          "payment_rail_run_reversed",
          "payment_rail_run_moved",
          "payment_rail_confirmation_needed",
          "payment_rail_run_changed",
          "payment_rail_nothing_to_send",
          "payment_rail_nothing_to_stop",
          "payment_rail_sending_now",
          "payment_rail_outcome_unknown",
          "payment_rail_payees_not_payable",
          "payment_rail_in_flight",
          "payment_run_lodgement_dispatched",
          "payment_return_file_invalid",
          "payment_return_file_duplicate",
          "payment_return_file_not_a_notice",
          "payment_return_run_not_released",
          "payment_return_run_not_eft",
          "payment_return_proposal_decided",
          "payment_run_outcome_with_open_returns",
          "vendor_query_arrival_changed",
          "vendor_statement_file_missing",
          "purchases_custom_field_values_bill_void",
          "purchases_custom_field_values_kind_unknown",
          "vendor_reopen_archived",
          "vendor_reopen_nothing_to_reopen",
          "vendor_reopen_decided_again",
          "vendor_restore_moved_on",
          "vendor_registration_check_replaced",
          "vendor_registration_stated_changed",
          "vendor_registration_earlier_check_unusable",
          "vendor_credit_moved_on",
          "payment_run_policy_pass_not_run",
          "payment_run_policy_pass_run_moved",
          "vendor_line_profile_not_proposal",
          "vendor_line_profile_not_dismissed",
          "vendor_line_profile_not_restorable",
          "vendor_line_profile_was_discarded_proposal",
          "inbox_suggestion_decline_moved_on",
          "bill_still_owed_moved_on",
          "bill_feed_decline_moved_on",
          "bill_submission_moved_on",
          "bill_prepaid_early_end_moved_on"
        ],
        "description": "The values listed in `x-extensible-enum` are the ones known today. New values can appear without a new release, so handle an unknown one as you would an unexpected state, not as a failure to parse."
      },
      "Code2": {
        "type": "string",
        "enum": [
          "NO_REGISTRATION",
          "OVER_CREDIT_LIMIT",
          "NO_FX_RATE",
          "LOW_CREDIT_RATING",
          "TREATMENT_NOT_AVAILABLE",
          "OVER_INSURED_LIMIT",
          "CREDIT_INSURANCE_EXPIRED",
          "INSURED_LIMIT_UNCHECKED",
          "RELIEF_NEEDS_CERTIFICATE",
          "OVERRIDE_REASON_MISSING",
          "PLACE_OF_SUPPLY_MISMATCH",
          "POSSIBLE_DUPLICATE",
          "UNUSUAL_AMOUNT",
          "DUE_DATE_PAST_TERMS",
          "NO_FREIGHT_ON_GOODS",
          "REQUIRED_FIELD_EMPTY",
          "OVER_CONTRACT",
          "OVER_PO",
          "NO_PAYMENT_DETAILS",
          "FRENCH_TEXT_MISSING"
        ]
      },
      "Components": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "taxType": {
              "type": "string"
            },
            "region": {
              "type": "string"
            },
            "rateE5": {
              "type": "string"
            },
            "taxMinor": {
              "type": "string",
              "pattern": "^-?\\d+$"
            }
          },
          "required": [
            "taxType",
            "region",
            "rateE5",
            "taxMinor"
          ],
          "additionalProperties": false
        }
      },
      "Contacts": {
        "maxItems": 20,
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "name": {
              "type": "string",
              "minLength": 1,
              "maxLength": 120
            },
            "email": {
              "type": "string",
              "maxLength": 200,
              "format": "email",
              "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
            },
            "role": {
              "type": "string",
              "enum": [
                "BILLING",
                "CC",
                "ESCALATION"
              ]
            },
            "phone": {
              "type": "string",
              "maxLength": 50
            }
          },
          "required": [
            "name",
            "email",
            "role"
          ],
          "additionalProperties": false
        }
      },
      "Corporation": {
        "type": "object",
        "properties": {
          "number": {
            "type": "string",
            "maxLength": 40
          },
          "jurisdiction": {
            "type": "string",
            "enum": [
              "FEDERAL",
              "AB",
              "BC",
              "MB",
              "NB",
              "NL",
              "NS",
              "NT",
              "NU",
              "ON",
              "PE",
              "QC",
              "SK",
              "YT"
            ]
          }
        },
        "required": [
          "number",
          "jurisdiction"
        ],
        "additionalProperties": false
      },
      "Counts2": {
        "type": "object",
        "properties": {
          "rows": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "ready": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "held": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "received": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "refused": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "alreadyOnBooks": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "readyInvoices": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          }
        },
        "required": [
          "rows",
          "ready",
          "held",
          "received",
          "refused",
          "readyInvoices"
        ],
        "additionalProperties": false
      },
      "CreateContractResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "entityId": {
            "type": "string"
          },
          "entityName": {
            "type": "string"
          },
          "entityTimeZone": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "enum": [
              "CONTRACT",
              "REPEAT"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "DRAFT",
              "ACTIVE",
              "COMPLETED",
              "CANCELLED"
            ]
          },
          "customer": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "displayName": {
                    "type": "string"
                  }
                },
                "required": [
                  "id",
                  "displayName"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "customerName": {
            "type": "string"
          },
          "externalRef": {
            "type": [
              "string",
              "null"
            ]
          },
          "currency": {
            "type": "string"
          },
          "startDate": {
            "type": "string",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
          },
          "endDate": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
              },
              {
                "type": "null"
              }
            ]
          },
          "billingFrequency": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "MONTHLY",
                  "QUARTERLY",
                  "YEARLY",
                  "ONCE_AT_END"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "firstBillingDate": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
              },
              {
                "type": "null"
              }
            ]
          },
          "lastBillingDate": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
              },
              {
                "type": "null"
              }
            ]
          },
          "perPeriodAmountMinor": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^-?\\d+$"
              },
              {
                "type": "null"
              }
            ]
          },
          "totalValueMinor": {
            "type": "string",
            "pattern": "^-?\\d+$"
          },
          "nextBillingDate": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
              },
              {
                "type": "null"
              }
            ]
          },
          "billedRows": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "rowCount": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "customerPo": {
            "$ref": "#/components/schemas/CustomerPo"
          },
          "invoicedMinor": {
            "type": "string",
            "pattern": "^-?\\d+$"
          },
          "remainingMinor": {
            "type": "string",
            "pattern": "^-?\\d+$"
          },
          "poDifferenceMinor": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^-?\\d+$"
              },
              {
                "type": "null"
              }
            ]
          },
          "lines": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "position": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                },
                "description": {
                  "type": "string"
                },
                "account": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "id",
                    "code",
                    "name"
                  ],
                  "additionalProperties": false
                },
                "product": {
                  "$ref": "#/components/schemas/Account"
                },
                "quantity": {
                  "type": "string"
                },
                "unitPriceMinor": {
                  "type": "string",
                  "pattern": "^-?\\d+$"
                },
                "netMinor": {
                  "type": "string",
                  "pattern": "^-?\\d+$"
                },
                "supplyCategory": {
                  "type": "string"
                },
                "treatmentHint": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "servicePeriodMonths": {
                  "anyOf": [
                    {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "dimensions": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "dimensionTypeId": {
                        "type": "string"
                      },
                      "dimensionValueId": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "dimensionTypeId",
                      "dimensionValueId"
                    ],
                    "additionalProperties": false
                  }
                }
              },
              "required": [
                "id",
                "position",
                "description",
                "account",
                "product",
                "quantity",
                "unitPriceMinor",
                "netMinor",
                "supplyCategory",
                "treatmentHint",
                "servicePeriodMonths",
                "dimensions"
              ],
              "additionalProperties": false
            }
          },
          "customFields": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "boolean"
                },
                {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                }
              ]
            }
          },
          "schedule": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "position": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "SCHEDULED",
                    "DUE",
                    "DRAFTED",
                    "BILLED",
                    "SKIPPED"
                  ]
                },
                "billingDate": {
                  "type": "string",
                  "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                },
                "periodStart": {
                  "type": "string",
                  "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                },
                "periodEnd": {
                  "type": "string",
                  "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                },
                "amountMinor": {
                  "type": "string",
                  "pattern": "^-?\\d+$"
                },
                "invoice": {
                  "$ref": "#/components/schemas/Invoice2"
                },
                "skippedBy": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "id",
                        "name"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "skippedAt": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 20
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "skipReason": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              },
              "required": [
                "id",
                "position",
                "status",
                "billingDate",
                "periodStart",
                "periodEnd",
                "amountMinor",
                "invoice",
                "skippedBy",
                "skippedAt",
                "skipReason"
              ],
              "additionalProperties": false
            }
          },
          "identity": {
            "type": "object",
            "properties": {
              "billedValueMinor": {
                "type": "string",
                "pattern": "^-?\\d+$"
              },
              "scheduledTotalMinor": {
                "type": "string",
                "pattern": "^-?\\d+$"
              },
              "holds": {
                "type": "boolean"
              },
              "message": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "billedValueMinor",
              "scheduledTotalMinor",
              "holds",
              "message"
            ],
            "additionalProperties": false
          },
          "approvedBy": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  }
                },
                "required": [
                  "id",
                  "name"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "approvedAt": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 20
              },
              {
                "type": "null"
              }
            ]
          },
          "activatedBy": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  }
                },
                "required": [
                  "id",
                  "name"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "activatedAt": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 20
              },
              {
                "type": "null"
              }
            ]
          },
          "createdBy": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  }
                },
                "required": [
                  "id",
                  "name"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "createdAt": {
            "type": "string",
            "minLength": 20
          },
          "cancelledAt": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 20
              },
              {
                "type": "null"
              }
            ]
          },
          "cancelledBy": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  }
                },
                "required": [
                  "id",
                  "name"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "cancelReason": {
            "type": [
              "string",
              "null"
            ]
          },
          "templateInvoice": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "number": {
                    "type": "string"
                  }
                },
                "required": [
                  "id",
                  "number"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "pendingChange": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "proposalId": {
                    "type": "string"
                  },
                  "reason": {
                    "type": "string"
                  },
                  "submittedBy": {
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "id",
                          "name"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "submittedAt": {
                    "type": "string",
                    "minLength": 20
                  },
                  "proposedRows": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "position": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "status": {
                          "type": "string",
                          "enum": [
                            "SCHEDULED",
                            "DUE",
                            "DRAFTED",
                            "BILLED",
                            "SKIPPED"
                          ]
                        },
                        "billingDate": {
                          "type": "string",
                          "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                        },
                        "periodStart": {
                          "type": "string",
                          "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                        },
                        "periodEnd": {
                          "type": "string",
                          "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                        },
                        "amountMinor": {
                          "type": "string",
                          "pattern": "^-?\\d+$"
                        }
                      },
                      "required": [
                        "position",
                        "status",
                        "billingDate",
                        "periodStart",
                        "periodEnd",
                        "amountMinor"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "proposedTotalMinor": {
                    "type": "string",
                    "pattern": "^-?\\d+$"
                  }
                },
                "required": [
                  "proposalId",
                  "reason",
                  "submittedBy",
                  "submittedAt",
                  "proposedRows",
                  "proposedTotalMinor"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "billing": {
            "$ref": "#/components/schemas/Billing"
          },
          "milestones": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "position": {
                  "type": "integer",
                  "minimum": 1,
                  "maximum": 9007199254740991
                },
                "name": {
                  "type": "string"
                },
                "percentBp": {
                  "type": "integer",
                  "minimum": 1,
                  "maximum": 10000
                },
                "amountMinor": {
                  "type": "string",
                  "pattern": "^-?\\d+$"
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "PENDING",
                    "BILLED"
                  ]
                },
                "invoice": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "number": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "id",
                        "number"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "reachedOn": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "reachedBy": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "id",
                        "name"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              },
              "required": [
                "id",
                "position",
                "name",
                "percentBp",
                "amountMinor",
                "status",
                "invoice",
                "reachedOn",
                "reachedBy"
              ],
              "additionalProperties": false
            }
          },
          "holdbackBp": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": 1,
                "maximum": 10000
              },
              {
                "type": "null"
              }
            ]
          },
          "holdbackReleaseDueOn": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
              },
              {
                "type": "null"
              }
            ]
          },
          "holdbackOverdueFlaggedAt": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 20
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "entityId",
          "entityName",
          "entityTimeZone",
          "kind",
          "status",
          "customer",
          "customerName",
          "externalRef",
          "currency",
          "startDate",
          "endDate",
          "billingFrequency",
          "firstBillingDate",
          "lastBillingDate",
          "perPeriodAmountMinor",
          "totalValueMinor",
          "nextBillingDate",
          "billedRows",
          "rowCount",
          "lines",
          "schedule",
          "identity",
          "approvedBy",
          "approvedAt",
          "activatedBy",
          "activatedAt",
          "createdBy",
          "createdAt",
          "templateInvoice",
          "pendingChange"
        ],
        "additionalProperties": false
      },
      "CreateCreditMemoResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "entityId": {
            "type": "string"
          },
          "entityName": {
            "type": "string"
          },
          "customer": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "displayName": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "displayName"
            ],
            "additionalProperties": false
          },
          "number": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "DRAFT",
              "APPROVED",
              "APPLIED",
              "VOID"
            ]
          },
          "issueDate": {
            "type": "string",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
          },
          "currency": {
            "type": "string",
            "pattern": "^[A-Z]{3}$"
          },
          "subtotalMinor": {
            "type": "string",
            "pattern": "^-?\\d+$"
          },
          "taxMinor": {
            "type": "string",
            "pattern": "^-?\\d+$"
          },
          "totalMinor": {
            "type": "string",
            "pattern": "^-?\\d+$"
          },
          "appliedMinor": {
            "type": "string",
            "pattern": "^-?\\d+$"
          },
          "unappliedMinor": {
            "type": "string",
            "pattern": "^-?\\d+$"
          },
          "refundedMinor": {
            "type": "string",
            "pattern": "^-?\\d+$"
          },
          "warnings": {
            "$ref": "#/components/schemas/Warnings2"
          },
          "reason": {
            "type": "string"
          },
          "adjustsInvoice": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "number": {
                    "type": "string"
                  }
                },
                "required": [
                  "id",
                  "number"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "lineCount": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "preGoLive": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "goLiveDate": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  }
                },
                "required": [
                  "goLiveDate"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "entryId": {
            "type": [
              "string",
              "null"
            ]
          },
          "entryNumber": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ]
          },
          "entryStatus": {
            "type": [
              "string",
              "null"
            ]
          },
          "memo": {
            "type": [
              "string",
              "null"
            ]
          },
          "customFields": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "boolean"
                },
                {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                }
              ]
            }
          },
          "lines": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "position": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                },
                "description": {
                  "type": "string"
                },
                "account": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "id",
                    "code",
                    "name"
                  ],
                  "additionalProperties": false
                },
                "quantity": {
                  "type": "string"
                },
                "unitPriceMinor": {
                  "anyOf": [
                    {
                      "type": "string",
                      "pattern": "^-?\\d+$"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "netMinor": {
                  "type": "string",
                  "pattern": "^-?\\d+$"
                },
                "taxMinor": {
                  "type": "string",
                  "pattern": "^-?\\d+$"
                },
                "supplyCategory": {
                  "type": "string",
                  "enum": [
                    "GOODS",
                    "SERVICES",
                    "INTANGIBLE_PROPERTY",
                    "REAL_PROPERTY"
                  ]
                },
                "treatmentHint": {
                  "anyOf": [
                    {
                      "type": "string",
                      "enum": [
                        "STANDARD",
                        "ZERO_RATED",
                        "EXEMPT",
                        "OUT_OF_SCOPE",
                        "RELIEVED"
                      ]
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "product": {
                  "$ref": "#/components/schemas/Account"
                },
                "dimensions": {
                  "$ref": "#/components/schemas/Dimensions3"
                },
                "customFields": {
                  "type": "object",
                  "propertyNames": {
                    "type": "string"
                  },
                  "additionalProperties": {
                    "type": [
                      "string",
                      "boolean"
                    ]
                  }
                },
                "carriedFrom": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              },
              "required": [
                "id",
                "position",
                "description",
                "account",
                "quantity",
                "unitPriceMinor",
                "netMinor",
                "taxMinor",
                "supplyCategory",
                "treatmentHint",
                "product",
                "dimensions"
              ],
              "additionalProperties": false
            }
          },
          "draftedBy": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "name"
            ],
            "additionalProperties": false
          },
          "approvedBy": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  }
                },
                "required": [
                  "id",
                  "name"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "approvedAt": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 20
              },
              {
                "type": "null"
              }
            ]
          },
          "proposal": {
            "$ref": "#/components/schemas/Proposal2"
          },
          "applications": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "invoiceId": {
                  "type": "string"
                },
                "invoiceNumber": {
                  "type": "string"
                },
                "amountMinor": {
                  "type": "string",
                  "pattern": "^-?\\d+$"
                },
                "appliedBy": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "id",
                    "name"
                  ],
                  "additionalProperties": false
                },
                "appliedAt": {
                  "type": "string",
                  "minLength": 20
                }
              },
              "required": [
                "id",
                "invoiceId",
                "invoiceNumber",
                "amountMinor",
                "appliedBy",
                "appliedAt"
              ],
              "additionalProperties": false
            }
          },
          "refunds": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "receiptId": {
                  "type": "string"
                },
                "amountMinor": {
                  "type": "string",
                  "pattern": "^-?\\d+$"
                },
                "paidOn": {
                  "type": "string",
                  "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                },
                "method": {
                  "type": "string",
                  "enum": [
                    "EFT",
                    "CHEQUE",
                    "CARD",
                    "CASH",
                    "OTHER",
                    "PAD",
                    "WIRE",
                    "DIRECT_DEPOSIT",
                    "ETRANSFER"
                  ]
                },
                "reference": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "bankAccount": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "displayName": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "id",
                    "displayName"
                  ],
                  "additionalProperties": false
                },
                "refundedBy": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "id",
                    "name"
                  ],
                  "additionalProperties": false
                },
                "refundedAt": {
                  "type": "string",
                  "minLength": 20
                },
                "entryId": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "entryNumber": {
                  "anyOf": [
                    {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "entryStatus": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              },
              "required": [
                "id",
                "receiptId",
                "amountMinor",
                "paidOn",
                "method",
                "reference",
                "bankAccount",
                "refundedBy",
                "refundedAt",
                "entryId",
                "entryNumber",
                "entryStatus"
              ],
              "additionalProperties": false
            }
          },
          "voidedAt": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 20
              },
              {
                "type": "null"
              }
            ]
          },
          "voidedBy": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  }
                },
                "required": [
                  "id",
                  "name"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "voidReason": {
            "type": [
              "string",
              "null"
            ]
          },
          "voidEntryId": {
            "type": [
              "string",
              "null"
            ]
          },
          "createdAt": {
            "type": "string",
            "minLength": 20
          }
        },
        "required": [
          "id",
          "entityId",
          "entityName",
          "customer",
          "number",
          "status",
          "issueDate",
          "currency",
          "subtotalMinor",
          "taxMinor",
          "totalMinor",
          "appliedMinor",
          "unappliedMinor",
          "refundedMinor",
          "warnings",
          "reason",
          "adjustsInvoice",
          "lineCount",
          "entryId",
          "entryNumber",
          "entryStatus",
          "memo",
          "lines",
          "draftedBy",
          "approvedBy",
          "approvedAt",
          "proposal",
          "applications",
          "refunds",
          "voidedAt",
          "voidedBy",
          "voidReason",
          "voidEntryId",
          "createdAt"
        ],
        "additionalProperties": false
      },
      "CreateCustomerResponse": {
        "anyOf": [
          {
            "$ref": "#/components/schemas/ArchiveCustomerResponse"
          },
          {
            "type": "object",
            "properties": {
              "proposalId": {
                "type": "string"
              },
              "status": {
                "type": "string",
                "const": "PENDING"
              },
              "message": {
                "type": "string"
              }
            },
            "required": [
              "proposalId",
              "status",
              "message"
            ],
            "additionalProperties": false
          }
        ]
      },
      "CreateInvoiceImportResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "entityId": {
            "type": "string"
          },
          "entityName": {
            "type": "string"
          },
          "fileName": {
            "type": "string"
          },
          "source": {
            "type": "string",
            "enum": [
              "CSV",
              "PDF",
              "EMAIL",
              "QBO",
              "HUBSPOT",
              "XERO",
              "STRIPE",
              "SHOPIFY",
              "SQUARE",
              "AMAZON",
              "HELCIM",
              "MIRAKL",
              "WOOCOMMERCE",
              "BIGCOMMERCE",
              "MAGENTO"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "REVIEW",
              "RECEIVED",
              "REVERTED"
            ]
          },
          "counts": {
            "$ref": "#/components/schemas/Counts2"
          },
          "uploadedBy": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "name"
            ],
            "additionalProperties": false
          },
          "createdAt": {
            "type": "string",
            "minLength": 20
          },
          "receivedAt": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 20
              },
              {
                "type": "null"
              }
            ]
          },
          "revertProposalId": {
            "type": [
              "string",
              "null"
            ]
          },
          "revertStatus": {
            "type": [
              "string",
              "null"
            ]
          },
          "revertProposedBy": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  }
                },
                "required": [
                  "id",
                  "name"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "revertedBy": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  }
                },
                "required": [
                  "id",
                  "name"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "revertedAt": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 20
              },
              {
                "type": "null"
              }
            ]
          },
          "revertReason": {
            "type": [
              "string",
              "null"
            ]
          },
          "reading": {
            "$ref": "#/components/schemas/Reading2"
          },
          "documentId": {
            "type": [
              "string",
              "null"
            ]
          },
          "documentKind": {
            "type": "string",
            "enum": [
              "INVOICE",
              "CUSTOMER_PO"
            ]
          },
          "duplicateOf": {
            "$ref": "#/components/schemas/DuplicateOf"
          },
          "mapping": {
            "type": "object",
            "properties": {
              "header": {
                "maxItems": 200,
                "type": "array",
                "items": {
                  "type": "string",
                  "maxLength": 200
                }
              },
              "fields": {
                "$ref": "#/components/schemas/Mapping"
              },
              "reading": {
                "default": null,
                "anyOf": [
                  {
                    "type": "object",
                    "properties": {
                      "state": {
                        "type": "string",
                        "enum": [
                          "READING",
                          "READ",
                          "REFUSED"
                        ]
                      },
                      "note": {
                        "default": null,
                        "anyOf": [
                          {
                            "type": "string",
                            "maxLength": 1000
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "pages": {
                        "default": null,
                        "anyOf": [
                          {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "ocr": {
                        "default": false,
                        "type": "boolean"
                      },
                      "origin": {
                        "default": null,
                        "anyOf": [
                          {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "EMAIL"
                              },
                              "address": {
                                "type": "string",
                                "maxLength": 320
                              },
                              "sender": {
                                "type": "string",
                                "maxLength": 320
                              },
                              "receivedAt": {
                                "type": "string",
                                "maxLength": 40
                              },
                              "documentId": {
                                "type": "string",
                                "maxLength": 64
                              }
                            },
                            "required": [
                              "kind",
                              "address",
                              "sender",
                              "receivedAt",
                              "documentId"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "null"
                          }
                        ]
                      }
                    },
                    "required": [
                      "state",
                      "note",
                      "pages",
                      "ocr",
                      "origin"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "header",
              "fields",
              "reading"
            ],
            "additionalProperties": false
          },
          "defaults": {
            "type": "object",
            "properties": {
              "region": {
                "default": null,
                "anyOf": [
                  {
                    "type": "string",
                    "maxLength": 10
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "accountId": {
                "default": null,
                "anyOf": [
                  {
                    "type": "string",
                    "maxLength": 64
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "supplyCategory": {
                "default": "SERVICES",
                "type": "string",
                "enum": [
                  "GOODS",
                  "SERVICES",
                  "INTANGIBLE_PROPERTY",
                  "REAL_PROPERTY"
                ]
              },
              "dayFirst": {
                "default": false,
                "type": "boolean"
              },
              "currency": {
                "type": "string",
                "pattern": "^[A-Z]{3}$"
              },
              "dimensions": {
                "default": [],
                "maxItems": 20,
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/DimensionsItem"
                }
              }
            },
            "required": [
              "region",
              "accountId",
              "supplyCategory",
              "dayFirst",
              "currency",
              "dimensions"
            ],
            "additionalProperties": false
          },
          "receivableAccountId": {
            "type": "string"
          },
          "requiredDimensions": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "dimensionTypeId": {
                  "type": "string"
                },
                "code": {
                  "type": "string"
                },
                "label": {
                  "type": "string"
                },
                "accountCodes": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "defaultValueId": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "values": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string"
                      },
                      "code": {
                        "type": "string"
                      },
                      "name": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "id",
                      "code",
                      "name"
                    ],
                    "additionalProperties": false
                  }
                },
                "valueCount": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                },
                "valuesNextCursor": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              },
              "required": [
                "dimensionTypeId",
                "code",
                "label",
                "accountCodes",
                "defaultValueId",
                "values",
                "valueCount",
                "valuesNextCursor"
              ],
              "additionalProperties": false
            }
          },
          "rows": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RowsItem"
            }
          },
          "rowsNextCursor": {
            "type": [
              "string",
              "null"
            ]
          },
          "outcome": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "received": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "alreadyOnBooks": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "invoiceNumber": {
                          "type": "string"
                        },
                        "invoiceId": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "lineNumber": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        }
                      },
                      "required": [
                        "invoiceNumber",
                        "invoiceId",
                        "lineNumber"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "refused": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "message": {
                    "type": "string"
                  }
                },
                "required": [
                  "received",
                  "alreadyOnBooks",
                  "refused",
                  "message"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "entityId",
          "entityName",
          "fileName",
          "source",
          "status",
          "counts",
          "uploadedBy",
          "createdAt",
          "receivedAt",
          "revertProposalId",
          "revertStatus",
          "revertProposedBy",
          "revertedBy",
          "revertedAt",
          "revertReason",
          "reading",
          "documentId",
          "mapping",
          "defaults",
          "receivableAccountId",
          "requiredDimensions",
          "rows",
          "rowsNextCursor"
        ],
        "additionalProperties": false
      },
      "CreditInsurance": {
        "type": "object",
        "properties": {
          "insurer": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "policyNumber": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100
          },
          "insuredLimitMinor": {
            "type": "string",
            "pattern": "^-?\\d+$"
          },
          "expiresOn": {
            "type": "string",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
          }
        },
        "required": [
          "insurer",
          "policyNumber",
          "insuredLimitMinor",
          "expiresOn"
        ],
        "additionalProperties": false
      },
      "CustomFields": {
        "type": "object",
        "propertyNames": {
          "type": "string",
          "pattern": "^[a-z][a-z0-9_]{0,39}$"
        },
        "additionalProperties": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 500
            },
            {
              "type": "boolean"
            },
            {
              "minItems": 1,
              "maxItems": 20,
              "type": "array",
              "items": {
                "type": "string",
                "maxLength": 80
              }
            }
          ]
        }
      },
      "CustomFields6": {
        "type": "object",
        "propertyNames": {
          "type": "string",
          "pattern": "^[a-z][a-z0-9_]{0,39}$"
        },
        "additionalProperties": {
          "anyOf": [
            {
              "anyOf": [
                {
                  "type": "string",
                  "maxLength": 500
                },
                {
                  "type": "boolean"
                },
                {
                  "minItems": 1,
                  "maxItems": 20,
                  "type": "array",
                  "items": {
                    "type": "string",
                    "maxLength": 80
                  }
                }
              ]
            },
            {
              "type": "null"
            }
          ]
        },
        "description": "Send only the fields you are changing. A field with a value is set to it, a field with null is cleared, and a field left out keeps the value it holds, so two people saving different fields of one record at once both keep their change. A clear on an archived field that holds a value is refused."
      },
      "CustomerCreditReclass": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "entryId": {
                "type": "string"
              },
              "amountMinor": {
                "type": "string",
                "pattern": "^-?\\d+$"
              },
              "entryDate": {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
              },
              "reversesOn": {
                "anyOf": [
                  {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "entryId",
              "amountMinor",
              "entryDate",
              "reversesOn"
            ],
            "additionalProperties": false
          },
          {
            "type": "null"
          }
        ]
      },
      "CustomerPo": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "number": {
                "type": "string"
              },
              "amountMinor": {
                "anyOf": [
                  {
                    "type": "string",
                    "pattern": "^-?\\d+$"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "taxInclusive": {
                "type": "boolean"
              },
              "document": {
                "anyOf": [
                  {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string"
                      },
                      "fileName": {
                        "type": "string"
                      },
                      "contentType": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "id",
                      "fileName",
                      "contentType"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "number",
              "amountMinor",
              "taxInclusive",
              "document"
            ],
            "additionalProperties": false
          },
          {
            "type": "null"
          }
        ]
      },
      "Data": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "id": {
              "type": "string"
            },
            "entityId": {
              "type": "string"
            },
            "entityName": {
              "type": "string"
            },
            "customer": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "displayName": {
                  "type": "string"
                }
              },
              "required": [
                "id",
                "displayName"
              ],
              "additionalProperties": false
            },
            "source": {
              "type": "string",
              "enum": [
                "CSV",
                "API",
                "ISSUED"
              ]
            },
            "externalId": {
              "type": [
                "string",
                "null"
              ]
            },
            "number": {
              "type": "string"
            },
            "issueDate": {
              "type": "string",
              "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
            },
            "dueDate": {
              "type": "string",
              "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
            },
            "createdAt": {
              "type": "string",
              "minLength": 20
            },
            "currency": {
              "type": "string",
              "pattern": "^[A-Z]{3}$"
            },
            "subtotalMinor": {
              "type": "string",
              "pattern": "^-?\\d+$"
            },
            "taxMinor": {
              "type": "string",
              "pattern": "^-?\\d+$"
            },
            "totalMinor": {
              "type": "string",
              "pattern": "^-?\\d+$"
            },
            "appliedMinor": {
              "type": "string",
              "pattern": "^-?\\d+$"
            },
            "creditedMinor": {
              "type": "string",
              "pattern": "^-?\\d+$"
            },
            "balanceMinor": {
              "type": "string",
              "pattern": "^-?\\d+$"
            },
            "preGoLive": {
              "anyOf": [
                {
                  "type": "object",
                  "properties": {
                    "goLiveDate": {
                      "type": "string",
                      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                    }
                  },
                  "required": [
                    "goLiveDate"
                  ],
                  "additionalProperties": false
                },
                {
                  "type": "null"
                }
              ]
            },
            "functionalCurrency": {
              "type": "string",
              "pattern": "^[A-Z]{3}$"
            },
            "functionalTotalMinor": {
              "type": "string",
              "pattern": "^-?\\d+$"
            },
            "functionalBalanceMinor": {
              "type": "string",
              "pattern": "^-?\\d+$"
            },
            "fxRate": {
              "type": [
                "string",
                "null"
              ]
            },
            "overdueDays": {
              "type": "integer",
              "minimum": -9007199254740991,
              "maximum": 9007199254740991
            },
            "status": {
              "type": "string",
              "enum": [
                "DRAFT",
                "APPROVED",
                "PARTIALLY_PAID",
                "PAID",
                "VOID",
                "WRITTEN_OFF"
              ]
            },
            "lineCount": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            },
            "entryId": {
              "type": [
                "string",
                "null"
              ]
            },
            "entryNumber": {
              "anyOf": [
                {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                },
                {
                  "type": "null"
                }
              ]
            },
            "entryStatus": {
              "type": [
                "string",
                "null"
              ]
            },
            "versionCount": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            },
            "creditNoteNumbers": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "sent": {
              "anyOf": [
                {
                  "type": "string",
                  "minLength": 20
                },
                {
                  "type": "null"
                }
              ]
            },
            "promisedToPayOn": {
              "anyOf": [
                {
                  "type": "string",
                  "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                },
                {
                  "type": "null"
                }
              ]
            },
            "customerReference": {
              "type": [
                "string",
                "null"
              ]
            },
            "writtenOffMinor": {
              "type": "string",
              "pattern": "^-?\\d+$"
            },
            "creditBandAtApproval": {
              "anyOf": [
                {
                  "type": "string",
                  "enum": [
                    "A",
                    "B",
                    "C",
                    "D",
                    "E",
                    "N"
                  ]
                },
                {
                  "type": "null"
                }
              ]
            },
            "creditScoreAtApproval": {
              "anyOf": [
                {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 100
                },
                {
                  "type": "null"
                }
              ]
            },
            "earlyPaymentDiscount": {
              "$ref": "#/components/schemas/EarlyPaymentDiscount"
            },
            "contractId": {
              "type": [
                "string",
                "null"
              ]
            },
            "waitingOn": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  }
                },
                "required": [
                  "id",
                  "name"
                ],
                "additionalProperties": false
              }
            },
            "delivery": {
              "type": "string",
              "enum": [
                "none",
                "sent",
                "waiting",
                "partly",
                "failed"
              ]
            },
            "inReview": {
              "type": "boolean"
            }
          },
          "required": [
            "id",
            "entityId",
            "entityName",
            "customer",
            "source",
            "externalId",
            "number",
            "issueDate",
            "dueDate",
            "createdAt",
            "currency",
            "subtotalMinor",
            "taxMinor",
            "totalMinor",
            "appliedMinor",
            "creditedMinor",
            "balanceMinor",
            "functionalCurrency",
            "functionalTotalMinor",
            "functionalBalanceMinor",
            "fxRate",
            "overdueDays",
            "status",
            "lineCount",
            "entryId",
            "entryNumber",
            "entryStatus",
            "versionCount",
            "creditNoteNumbers",
            "sent",
            "promisedToPayOn",
            "customerReference",
            "writtenOffMinor",
            "creditBandAtApproval",
            "creditScoreAtApproval",
            "delivery",
            "inReview"
          ],
          "additionalProperties": false
        }
      },
      "DefaultDepartment": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "active": {
                "type": "boolean"
              }
            },
            "required": [
              "id",
              "name",
              "active"
            ],
            "additionalProperties": false
          },
          {
            "type": "null"
          }
        ]
      },
      "Deliveries": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "id": {
              "type": "string"
            },
            "recipient": {
              "type": "string"
            },
            "role": {
              "type": "string",
              "enum": [
                "BILLING",
                "CC",
                "ESCALATION"
              ]
            },
            "status": {
              "type": "string",
              "enum": [
                "QUEUED",
                "SENT",
                "BOUNCED",
                "FAILED"
              ]
            },
            "messageId": {
              "type": [
                "string",
                "null"
              ]
            },
            "sentAt": {
              "anyOf": [
                {
                  "type": "string",
                  "minLength": 20
                },
                {
                  "type": "null"
                }
              ]
            },
            "error": {
              "type": [
                "string",
                "null"
              ]
            },
            "language": {
              "type": "string",
              "enum": [
                "en",
                "fr"
              ]
            },
            "sentBy": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                }
              },
              "required": [
                "id",
                "name"
              ],
              "additionalProperties": false
            },
            "createdAt": {
              "type": "string",
              "minLength": 20
            },
            "channel": {
              "type": "string",
              "enum": [
                "EMAIL",
                "POST",
                "HAND",
                "OTHER_SYSTEM"
              ]
            },
            "kind": {
              "type": "string",
              "enum": [
                "INVOICE",
                "CREDIT_MEMO",
                "STATEMENT",
                "REMINDER"
              ]
            },
            "note": {
              "type": [
                "string",
                "null"
              ]
            },
            "stepOffsetDays": {
              "anyOf": [
                {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                },
                {
                  "type": "null"
                }
              ]
            }
          },
          "required": [
            "id",
            "recipient",
            "role",
            "status",
            "messageId",
            "sentAt",
            "error",
            "language",
            "sentBy",
            "createdAt",
            "channel",
            "kind",
            "note",
            "stepOffsetDays"
          ],
          "additionalProperties": false
        }
      },
      "Deposit": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "accountId": {
                "type": "string"
              },
              "accountCode": {
                "type": "string"
              },
              "accountName": {
                "type": "string"
              },
              "refundedMinor": {
                "type": "string",
                "pattern": "^-?\\d+$"
              },
              "onHandMinor": {
                "type": "string",
                "pattern": "^-?\\d+$"
              }
            },
            "required": [
              "accountId",
              "accountCode",
              "accountName",
              "refundedMinor",
              "onHandMinor"
            ],
            "additionalProperties": false
          },
          {
            "type": "null"
          }
        ]
      },
      "Diff": {
        "anyOf": [
          {
            "$ref": "#/components/schemas/DiffOption1"
          },
          {
            "type": "null"
          }
        ]
      },
      "DiffOption1": {
        "type": "object",
        "properties": {
          "head": {
            "$ref": "#/components/schemas/Head"
          },
          "lines": {
            "$ref": "#/components/schemas/Lines2"
          },
          "totalBeforeMinor": {
            "type": "string",
            "pattern": "^-?\\d+$"
          },
          "totalAfterMinor": {
            "type": "string",
            "pattern": "^-?\\d+$"
          },
          "currency": {
            "type": "string",
            "pattern": "^[A-Z]{3}$"
          }
        },
        "required": [
          "head",
          "lines",
          "totalBeforeMinor",
          "totalAfterMinor",
          "currency"
        ],
        "additionalProperties": false
      },
      "Dimensions2": {
        "maxItems": 20,
        "type": "array",
        "items": {
          "$ref": "#/components/schemas/DimensionsItem"
        }
      },
      "Dimensions3": {
        "type": "array",
        "items": {
          "$ref": "#/components/schemas/DimensionsItem"
        }
      },
      "DimensionsItem": {
        "type": "object",
        "properties": {
          "dimensionTypeId": {
            "type": "string",
            "minLength": 1
          },
          "dimensionValueId": {
            "type": "string",
            "minLength": 1
          }
        },
        "required": [
          "dimensionTypeId",
          "dimensionValueId"
        ],
        "additionalProperties": false
      },
      "DuplicateOf": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "importId": {
                "type": "string"
              },
              "fileName": {
                "type": "string"
              },
              "uploadedBy": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  }
                },
                "required": [
                  "id",
                  "name"
                ],
                "additionalProperties": false
              },
              "uploadedAt": {
                "type": "string",
                "minLength": 20
              }
            },
            "required": [
              "importId",
              "fileName",
              "uploadedBy",
              "uploadedAt"
            ],
            "additionalProperties": false
          },
          {
            "type": "null"
          }
        ]
      },
      "EarlyPaymentDiscount": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "discountBp": {
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              },
              "discountDays": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "closesOn": {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
              }
            },
            "required": [
              "discountBp",
              "discountDays",
              "closesOn"
            ],
            "additionalProperties": false
          },
          {
            "type": "null"
          }
        ]
      },
      "Engine": {
        "type": "object",
        "properties": {
          "treatment": {
            "type": "string",
            "enum": [
              "STANDARD",
              "ZERO_RATED",
              "EXEMPT",
              "OUT_OF_SCOPE",
              "RELIEVED"
            ]
          },
          "codeName": {
            "type": [
              "string",
              "null"
            ]
          },
          "taxMinor": {
            "type": "string",
            "pattern": "^-?\\d+$"
          }
        },
        "required": [
          "treatment",
          "codeName",
          "taxMinor"
        ],
        "additionalProperties": false
      },
      "ExternalRef": {
        "type": "object",
        "properties": {
          "provider": {
            "type": "string",
            "enum": [
              "STRIPE",
              "HUBSPOT",
              "QBO",
              "XERO"
            ]
          },
          "externalId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 255
          },
          "externalLabel": {
            "type": "string",
            "minLength": 1,
            "maxLength": 255
          }
        },
        "required": [
          "provider",
          "externalId"
        ],
        "additionalProperties": false
      },
      "GetCatalogueSettingsResponse": {
        "type": "object",
        "properties": {
          "revenueAccountId": {
            "type": [
              "string",
              "null"
            ]
          },
          "revenueAccountCode": {
            "type": [
              "string",
              "null"
            ]
          },
          "revenueAccountName": {
            "type": [
              "string",
              "null"
            ]
          },
          "supplyCategory": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "GOODS",
                  "SERVICES",
                  "INTANGIBLE_PROPERTY",
                  "REAL_PROPERTY"
                ]
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "revenueAccountId",
          "revenueAccountCode",
          "revenueAccountName",
          "supplyCategory"
        ],
        "additionalProperties": false
      },
      "GetInvoiceNumberSeriesResponse": {
        "type": "object",
        "properties": {
          "entityId": {
            "type": "string"
          },
          "prefix": {
            "type": "string"
          },
          "next": {
            "type": "integer",
            "minimum": 1,
            "maximum": 9007199254740991
          },
          "padding": {
            "type": "integer",
            "minimum": 1,
            "maximum": 12
          },
          "nextNumber": {
            "type": "string"
          },
          "updatedAt": {
            "type": "string",
            "minLength": 20
          }
        },
        "required": [
          "entityId",
          "prefix",
          "next",
          "padding",
          "nextNumber",
          "updatedAt"
        ],
        "additionalProperties": false
      },
      "GetInvoiceResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "entityId": {
            "type": "string"
          },
          "entityName": {
            "type": "string"
          },
          "customer": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "displayName": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "displayName"
            ],
            "additionalProperties": false
          },
          "source": {
            "type": "string",
            "enum": [
              "CSV",
              "API",
              "ISSUED"
            ]
          },
          "externalId": {
            "type": [
              "string",
              "null"
            ]
          },
          "number": {
            "type": "string"
          },
          "issueDate": {
            "type": "string",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
          },
          "dueDate": {
            "type": "string",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
          },
          "createdAt": {
            "type": "string",
            "minLength": 20
          },
          "currency": {
            "type": "string",
            "pattern": "^[A-Z]{3}$"
          },
          "subtotalMinor": {
            "type": "string",
            "pattern": "^-?\\d+$"
          },
          "taxMinor": {
            "type": "string",
            "pattern": "^-?\\d+$"
          },
          "totalMinor": {
            "type": "string",
            "pattern": "^-?\\d+$"
          },
          "appliedMinor": {
            "type": "string",
            "pattern": "^-?\\d+$"
          },
          "creditedMinor": {
            "type": "string",
            "pattern": "^-?\\d+$"
          },
          "balanceMinor": {
            "type": "string",
            "pattern": "^-?\\d+$"
          },
          "preGoLive": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "goLiveDate": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  }
                },
                "required": [
                  "goLiveDate"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "functionalCurrency": {
            "type": "string",
            "pattern": "^[A-Z]{3}$"
          },
          "functionalTotalMinor": {
            "type": "string",
            "pattern": "^-?\\d+$"
          },
          "functionalBalanceMinor": {
            "type": "string",
            "pattern": "^-?\\d+$"
          },
          "fxRate": {
            "type": [
              "string",
              "null"
            ]
          },
          "overdueDays": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "status": {
            "type": "string",
            "enum": [
              "DRAFT",
              "APPROVED",
              "PARTIALLY_PAID",
              "PAID",
              "VOID",
              "WRITTEN_OFF"
            ]
          },
          "lineCount": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "entryId": {
            "type": [
              "string",
              "null"
            ]
          },
          "entryNumber": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ]
          },
          "entryStatus": {
            "type": [
              "string",
              "null"
            ]
          },
          "versionCount": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "creditNoteNumbers": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "sent": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 20
              },
              {
                "type": "null"
              }
            ]
          },
          "promisedToPayOn": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
              },
              {
                "type": "null"
              }
            ]
          },
          "customerReference": {
            "type": [
              "string",
              "null"
            ]
          },
          "writtenOffMinor": {
            "type": "string",
            "pattern": "^-?\\d+$"
          },
          "creditBandAtApproval": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "A",
                  "B",
                  "C",
                  "D",
                  "E",
                  "N"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "creditScoreAtApproval": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": 0,
                "maximum": 100
              },
              {
                "type": "null"
              }
            ]
          },
          "earlyPaymentDiscount": {
            "$ref": "#/components/schemas/EarlyPaymentDiscount"
          },
          "contractId": {
            "type": [
              "string",
              "null"
            ]
          },
          "waitingOn": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                }
              },
              "required": [
                "id",
                "name"
              ],
              "additionalProperties": false
            }
          },
          "delivery": {
            "type": "string",
            "enum": [
              "none",
              "sent",
              "waiting",
              "partly",
              "failed"
            ]
          },
          "inReview": {
            "type": "boolean"
          },
          "memo": {
            "type": [
              "string",
              "null"
            ]
          },
          "customFields": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "boolean"
                },
                {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                }
              ]
            }
          },
          "department": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "typeId": {
                    "type": "string"
                  },
                  "label": {
                    "type": "string"
                  },
                  "value": {
                    "$ref": "#/components/schemas/DefaultDepartment"
                  },
                  "lines": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "position": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "value": {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string"
                            },
                            "name": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "id",
                            "name"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "required": [
                        "position",
                        "value"
                      ],
                      "additionalProperties": false
                    }
                  }
                },
                "required": [
                  "typeId",
                  "label",
                  "value",
                  "lines"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "shipTo": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "label": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "lines": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "kind": {
                    "type": "string",
                    "enum": [
                      "BILLING",
                      "SHIP_TO"
                    ]
                  },
                  "country": {
                    "type": "string"
                  },
                  "region": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "needsSplit": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "id",
                  "label",
                  "lines"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "placeOfSupply": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "country": {
                    "type": "string"
                  },
                  "region": {
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                },
                "required": [
                  "country",
                  "region"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "lines": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "position": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                },
                "description": {
                  "type": "string"
                },
                "account": {
                  "$ref": "#/components/schemas/Account"
                },
                "quantity": {
                  "type": "string"
                },
                "unitPriceMinor": {
                  "anyOf": [
                    {
                      "type": "string",
                      "pattern": "^-?\\d+$"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "nonRevenue": {
                  "type": "boolean"
                },
                "customerPriceId": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "countryOfOrigin": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "hsCode": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "discountMinor": {
                  "type": "string",
                  "pattern": "^-?\\d+$"
                },
                "discountBp": {
                  "anyOf": [
                    {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 10000
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "grossMinor": {
                  "type": "string",
                  "pattern": "^-?\\d+$"
                },
                "netMinor": {
                  "type": "string",
                  "pattern": "^-?\\d+$"
                },
                "taxMinor": {
                  "type": "string",
                  "pattern": "^-?\\d+$"
                },
                "supplyCategory": {
                  "type": "string",
                  "enum": [
                    "GOODS",
                    "SERVICES",
                    "INTANGIBLE_PROPERTY",
                    "REAL_PROPERTY"
                  ]
                },
                "treatmentHint": {
                  "anyOf": [
                    {
                      "type": "string",
                      "enum": [
                        "STANDARD",
                        "ZERO_RATED",
                        "EXEMPT",
                        "OUT_OF_SCOPE",
                        "RELIEVED"
                      ]
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "product": {
                  "$ref": "#/components/schemas/Account"
                },
                "dimensions": {
                  "$ref": "#/components/schemas/Dimensions3"
                },
                "servicePeriodStart": {
                  "anyOf": [
                    {
                      "type": "string",
                      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "servicePeriodEnd": {
                  "anyOf": [
                    {
                      "type": "string",
                      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "reserveConnection": {
                  "anyOf": [
                    {
                      "type": "string",
                      "enum": [
                        "DELIVERED_TO_RESERVE",
                        "PERFORMED_ON_RESERVE",
                        "SITUATED_ON_RESERVE",
                        "FOR_BAND_MANAGEMENT"
                      ]
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "relief": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "certificateId": {
                          "type": "string"
                        },
                        "holderKind": {
                          "anyOf": [
                            {
                              "type": "string",
                              "enum": [
                                "INDIVIDUAL",
                                "BAND",
                                "BAND_EMPOWERED_ENTITY",
                                "INCORPORATED_BAND_EMPOWERED_ENTITY"
                              ]
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "bandName": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "effectiveFrom": {
                          "type": "string",
                          "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                        },
                        "expiresOn": {
                          "anyOf": [
                            {
                              "type": "string",
                              "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      },
                      "required": [
                        "certificateId",
                        "holderKind",
                        "bandName",
                        "effectiveFrom",
                        "expiresOn"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "taxOverride": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "treatment": {
                          "type": "string",
                          "enum": [
                            "ZERO_RATED",
                            "EXEMPT",
                            "OUT_OF_SCOPE"
                          ]
                        },
                        "reason": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "overriddenBy": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": "string"
                                },
                                "name": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "id",
                                "name"
                              ],
                              "additionalProperties": false
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "overriddenAt": {
                          "anyOf": [
                            {
                              "type": "string",
                              "minLength": 20
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "engine": {
                          "$ref": "#/components/schemas/Engine"
                        }
                      },
                      "required": [
                        "treatment",
                        "reason",
                        "overriddenBy",
                        "overriddenAt",
                        "engine"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "provincialExemption": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "certificateId": {
                          "type": "string"
                        },
                        "jurisdiction": {
                          "type": "string"
                        },
                        "certificateNumber": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "memo": {
                          "type": [
                            "string",
                            "null"
                          ]
                        }
                      },
                      "required": [
                        "certificateId",
                        "jurisdiction",
                        "certificateNumber",
                        "memo"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "itemTreatment": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "treatment": {
                          "type": "string",
                          "enum": [
                            "STANDARD",
                            "ZERO_RATED",
                            "EXEMPT",
                            "OUT_OF_SCOPE",
                            "RELIEVED"
                          ]
                        },
                        "reason": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "treatment",
                        "reason"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "hintOverride": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "treatment": {
                          "type": "string",
                          "enum": [
                            "STANDARD",
                            "ZERO_RATED",
                            "EXEMPT",
                            "OUT_OF_SCOPE",
                            "RELIEVED"
                          ]
                        },
                        "item": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": "string"
                                },
                                "name": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "id",
                                "name"
                              ],
                              "additionalProperties": false
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "reason": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "overriddenBy": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": "string"
                                },
                                "name": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "id",
                                "name"
                              ],
                              "additionalProperties": false
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "overriddenAt": {
                          "anyOf": [
                            {
                              "type": "string",
                              "minLength": 20
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "engine": {
                          "$ref": "#/components/schemas/Engine"
                        }
                      },
                      "required": [
                        "treatment",
                        "item",
                        "reason",
                        "overriddenBy",
                        "overriddenAt",
                        "engine"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "chargeKind": {
                  "anyOf": [
                    {
                      "type": "string",
                      "enum": [
                        "FREIGHT",
                        "FREIGHT_INSURANCE",
                        "HOLDBACK_WITHHELD",
                        "HOLDBACK_RELEASE"
                      ]
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "earnedLater": {
                  "anyOf": [
                    {
                      "type": "string",
                      "enum": [
                        "OVER_PERIOD_BY_MONTH",
                        "OVER_PERIOD_BY_DAY",
                        "ON_DATE",
                        "WHEN_RECOGNISED",
                        "BY_MILESTONE"
                      ]
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "earnOn": {
                  "anyOf": [
                    {
                      "type": "string",
                      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "contractMilestoneId": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "customFields": {
                  "type": "object",
                  "propertyNames": {
                    "type": "string"
                  },
                  "additionalProperties": {
                    "type": [
                      "string",
                      "boolean"
                    ]
                  }
                },
                "carriedFrom": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              },
              "required": [
                "id",
                "position",
                "description",
                "account",
                "quantity",
                "unitPriceMinor",
                "nonRevenue",
                "customerPriceId",
                "countryOfOrigin",
                "hsCode",
                "discountMinor",
                "discountBp",
                "grossMinor",
                "netMinor",
                "taxMinor",
                "supplyCategory",
                "treatmentHint",
                "product",
                "dimensions",
                "servicePeriodStart",
                "servicePeriodEnd"
              ],
              "additionalProperties": false
            }
          },
          "termsStamp": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "name": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "netDays": {
                    "anyOf": [
                      {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "discountBp": {
                    "anyOf": [
                      {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "discountDays": {
                    "anyOf": [
                      {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "interestMonthlyBp": {
                    "anyOf": [
                      {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "interestAnnualBp": {
                    "anyOf": [
                      {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "name",
                  "netDays",
                  "discountBp",
                  "discountDays",
                  "interestMonthlyBp",
                  "interestAnnualBp"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "collection": {
            "type": "object",
            "properties": {
              "promisedToPayOn": {
                "anyOf": [
                  {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "note": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "noteBy": {
                "anyOf": [
                  {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string"
                      },
                      "name": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "id",
                      "name"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "noteAt": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 20
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "promisedToPayOn",
              "note",
              "noteBy",
              "noteAt"
            ],
            "additionalProperties": false
          },
          "writeOff": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "amountMinor": {
                    "type": "string",
                    "pattern": "^-?\\d+$"
                  },
                  "at": {
                    "type": "string",
                    "minLength": 20
                  },
                  "by": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string"
                      },
                      "name": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "id",
                      "name"
                    ],
                    "additionalProperties": false
                  },
                  "reason": {
                    "type": "string"
                  },
                  "armsLength": {
                    "type": "boolean"
                  },
                  "entryId": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "entryNumber": {
                    "anyOf": [
                      {
                        "type": "integer",
                        "minimum": -9007199254740991,
                        "maximum": 9007199254740991
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "recoveredMinor": {
                    "type": "string",
                    "pattern": "^-?\\d+$"
                  }
                },
                "required": [
                  "amountMinor",
                  "at",
                  "by",
                  "reason",
                  "armsLength",
                  "entryId",
                  "entryNumber",
                  "recoveredMinor"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "writeOffProposal": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "amountMinor": {
                    "type": "string",
                    "pattern": "^-?\\d+$"
                  },
                  "reason": {
                    "type": "string"
                  },
                  "armsLength": {
                    "type": "boolean"
                  },
                  "armsLengthReason": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "submittedBy": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string"
                      },
                      "name": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "id",
                      "name"
                    ],
                    "additionalProperties": false
                  },
                  "submittedAt": {
                    "type": "string",
                    "minLength": 20
                  }
                },
                "required": [
                  "id",
                  "amountMinor",
                  "reason",
                  "armsLength",
                  "submittedBy",
                  "submittedAt"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "draftedBy": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  }
                },
                "required": [
                  "id",
                  "name"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "approvedBy": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  }
                },
                "required": [
                  "id",
                  "name"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "approvedAt": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 20
              },
              {
                "type": "null"
              }
            ]
          },
          "proposal": {
            "$ref": "#/components/schemas/Proposal2"
          },
          "warnings": {
            "$ref": "#/components/schemas/Warnings"
          },
          "creditApprovals": {
            "type": "object",
            "properties": {
              "required": {
                "type": "integer",
                "minimum": 1,
                "maximum": 2
              },
              "recorded": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "approver": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "id",
                        "name"
                      ],
                      "additionalProperties": false
                    },
                    "approvedAt": {
                      "type": "string",
                      "minLength": 20
                    }
                  },
                  "required": [
                    "approver",
                    "approvedAt"
                  ],
                  "additionalProperties": false
                }
              }
            },
            "required": [
              "required",
              "recorded"
            ],
            "additionalProperties": false
          },
          "customerRelatedParty": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "note": {
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                },
                "required": [
                  "note"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "voidedAt": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 20
              },
              {
                "type": "null"
              }
            ]
          },
          "voidedBy": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  }
                },
                "required": [
                  "id",
                  "name"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "voidReason": {
            "type": [
              "string",
              "null"
            ]
          },
          "voidEntryId": {
            "type": [
              "string",
              "null"
            ]
          },
          "importedBy": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "name"
            ],
            "additionalProperties": false
          },
          "applications": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "receiptId": {
                  "type": "string"
                },
                "receivedOn": {
                  "type": "string",
                  "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                },
                "method": {
                  "type": "string",
                  "enum": [
                    "EFT",
                    "CHEQUE",
                    "CARD",
                    "CASH",
                    "OTHER",
                    "PAD",
                    "WIRE",
                    "DIRECT_DEPOSIT",
                    "ETRANSFER"
                  ]
                },
                "reference": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "amountMinor": {
                  "type": "string",
                  "pattern": "^-?\\d+$"
                },
                "discountTakenMinor": {
                  "type": "string",
                  "pattern": "^-?\\d+$"
                },
                "lateDiscountClaimedMinor": {
                  "type": "string",
                  "pattern": "^-?\\d+$"
                }
              },
              "required": [
                "receiptId",
                "receivedOn",
                "method",
                "reference",
                "amountMinor"
              ],
              "additionalProperties": false
            }
          },
          "creditApplications": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "creditMemoId": {
                  "type": "string"
                },
                "creditMemoNumber": {
                  "type": "string"
                },
                "amountMinor": {
                  "type": "string",
                  "pattern": "^-?\\d+$"
                },
                "appliedAt": {
                  "type": "string",
                  "minLength": 20
                }
              },
              "required": [
                "id",
                "creditMemoId",
                "creditMemoNumber",
                "amountMinor",
                "appliedAt"
              ],
              "additionalProperties": false
            }
          },
          "dispute": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "status": {
                    "type": "string",
                    "enum": [
                      "OPEN",
                      "RESOLVED"
                    ]
                  },
                  "reason": {
                    "type": "string"
                  },
                  "raisedAt": {
                    "type": "string",
                    "minLength": 20
                  },
                  "resolvedAt": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 20
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "resolvedBy": {
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "name": {
                            "type": [
                              "string",
                              "null"
                            ]
                          }
                        },
                        "required": [
                          "id",
                          "name"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "resolution": {
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                },
                "required": [
                  "id",
                  "status",
                  "reason",
                  "raisedAt",
                  "resolvedAt",
                  "resolvedBy",
                  "resolution"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "contract": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "label": {
                    "type": "string"
                  },
                  "status": {
                    "type": "string",
                    "enum": [
                      "DRAFT",
                      "ACTIVE",
                      "COMPLETED",
                      "CANCELLED"
                    ]
                  },
                  "basis": {
                    "type": "string",
                    "enum": [
                      "SCHEDULE",
                      "AMOUNT",
                      "PERCENT",
                      "LINES",
                      "MILESTONE",
                      "PERCENT_COMPLETE",
                      "HOLDBACK_RELEASE"
                    ]
                  },
                  "customerPo": {
                    "$ref": "#/components/schemas/CustomerPo"
                  },
                  "billing": {
                    "$ref": "#/components/schemas/Billing"
                  },
                  "milestone": {
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "percentBp": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          }
                        },
                        "required": [
                          "id",
                          "name",
                          "percentBp"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "holdbackBp": {
                    "anyOf": [
                      {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 10000
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "id",
                  "label",
                  "status",
                  "basis",
                  "customerPo",
                  "billing"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "receivableAccountId": {
            "type": [
              "string",
              "null"
            ]
          },
          "approvalStage": {
            "type": "string",
            "enum": [
              "DRAFT",
              "PENDING_APPROVAL",
              "APPROVED"
            ]
          },
          "nobodyElse": {
            "type": "boolean"
          },
          "approvalChecks": {
            "type": "object",
            "properties": {
              "warnings": {
                "$ref": "#/components/schemas/Warnings"
              },
              "acknowledgements": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "stage": {
                      "type": "string",
                      "enum": [
                        "SUBMIT",
                        "APPROVE"
                      ]
                    },
                    "revision": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 9007199254740991
                    },
                    "code": {
                      "$ref": "#/components/schemas/Code2"
                    },
                    "subjectKey": {
                      "type": "string"
                    },
                    "note": {
                      "type": "string"
                    },
                    "by": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "id",
                        "name"
                      ],
                      "additionalProperties": false
                    },
                    "at": {
                      "type": "string",
                      "minLength": 20
                    }
                  },
                  "required": [
                    "stage",
                    "revision",
                    "code",
                    "subjectKey",
                    "note",
                    "by",
                    "at"
                  ],
                  "additionalProperties": false
                }
              }
            },
            "required": [
              "warnings",
              "acknowledgements"
            ],
            "additionalProperties": false
          },
          "approvers": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                }
              },
              "required": [
                "id",
                "name"
              ],
              "additionalProperties": false
            }
          },
          "usualAmountNote": {
            "type": [
              "string",
              "null"
            ]
          },
          "taxLines": {
            "$ref": "#/components/schemas/TaxLines"
          },
          "customerPo": {
            "$ref": "#/components/schemas/CustomerPo"
          },
          "preparedFromPo": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "number": {
                    "type": "string"
                  }
                },
                "required": [
                  "number"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "internalNote": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "text": {
                    "type": "string"
                  },
                  "by": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string"
                      },
                      "name": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "id",
                      "name"
                    ],
                    "additionalProperties": false
                  },
                  "at": {
                    "type": "string",
                    "minLength": 20
                  }
                },
                "required": [
                  "text",
                  "by",
                  "at"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "supersedes": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "number": {
                    "type": "string"
                  }
                },
                "required": [
                  "id",
                  "number"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "reissuedAs": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "number": {
                    "type": "string"
                  }
                },
                "required": [
                  "id",
                  "number"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "corrections": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "route": {
                  "type": "string",
                  "enum": [
                    "REVERSE_AND_REPOST",
                    "VOID_AND_REISSUE",
                    "CREDIT_NOTE"
                  ]
                },
                "label": {
                  "type": "string"
                },
                "whenToUse": {
                  "type": "string"
                },
                "enabled": {
                  "type": "boolean"
                },
                "disabledReason": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              },
              "required": [
                "route",
                "label",
                "whenToUse",
                "enabled",
                "disabledReason"
              ],
              "additionalProperties": false
            }
          },
          "registrations": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "taxType": {
                  "type": "string",
                  "enum": [
                    "GST_HST",
                    "QST",
                    "PST_BC",
                    "PST_SK",
                    "PST_MB",
                    "US_SALES_TAX"
                  ]
                },
                "region": {
                  "anyOf": [
                    {
                      "type": "string",
                      "pattern": "^(CA|US)-[A-Z]{2}$"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "number": {
                  "type": "string"
                },
                "label": {
                  "type": "string"
                }
              },
              "required": [
                "taxType",
                "region",
                "number",
                "label"
              ],
              "additionalProperties": false
            }
          },
          "paymentInstructions": {
            "type": "object",
            "properties": {
              "language": {
                "type": "string",
                "enum": [
                  "en",
                  "fr"
                ]
              },
              "set": {
                "type": "boolean"
              },
              "howToPay": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "bankDetailsPrinted": {
                "type": "boolean"
              },
              "paymentLink": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "terms": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "language",
              "set",
              "howToPay",
              "bankDetailsPrinted",
              "paymentLink",
              "terms"
            ],
            "additionalProperties": false
          },
          "duties": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "duty": {
                  "type": "string",
                  "enum": [
                    "DRAFTED",
                    "SUBMITTED",
                    "APPROVED",
                    "SENT",
                    "RECONCILED"
                  ]
                },
                "by": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "id",
                        "name"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "at": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 20
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              },
              "required": [
                "duty",
                "by",
                "at"
              ],
              "additionalProperties": false
            }
          },
          "contractBillingBasis": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "SCHEDULE",
                  "AMOUNT",
                  "PERCENT",
                  "LINES",
                  "MILESTONE",
                  "PERCENT_COMPLETE",
                  "HOLDBACK_RELEASE"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "contractMilestoneId": {
            "type": [
              "string",
              "null"
            ]
          },
          "percentCompleteBp": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": 1,
                "maximum": 10000
              },
              {
                "type": "null"
              }
            ]
          },
          "voidedByImport": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "importId": {
                    "type": "string"
                  },
                  "fileName": {
                    "type": "string"
                  },
                  "reason": {
                    "type": "string"
                  }
                },
                "required": [
                  "importId",
                  "fileName",
                  "reason"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "entityId",
          "entityName",
          "customer",
          "source",
          "externalId",
          "number",
          "issueDate",
          "dueDate",
          "createdAt",
          "currency",
          "subtotalMinor",
          "taxMinor",
          "totalMinor",
          "appliedMinor",
          "creditedMinor",
          "balanceMinor",
          "functionalCurrency",
          "functionalTotalMinor",
          "functionalBalanceMinor",
          "fxRate",
          "overdueDays",
          "status",
          "lineCount",
          "entryId",
          "entryNumber",
          "entryStatus",
          "versionCount",
          "creditNoteNumbers",
          "sent",
          "promisedToPayOn",
          "customerReference",
          "writtenOffMinor",
          "creditBandAtApproval",
          "creditScoreAtApproval",
          "delivery",
          "inReview",
          "memo",
          "lines",
          "termsStamp",
          "collection",
          "writeOff",
          "writeOffProposal",
          "draftedBy",
          "approvedBy",
          "approvedAt",
          "proposal",
          "warnings",
          "voidedAt",
          "voidedBy",
          "voidReason",
          "voidEntryId",
          "importedBy",
          "applications",
          "creditApplications"
        ],
        "additionalProperties": false
      },
      "GetInvoiceSendingResponse": {
        "type": "object",
        "properties": {
          "invoiceId": {
            "type": "string"
          },
          "deliveries": {
            "$ref": "#/components/schemas/Deliveries"
          },
          "pending": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "proposalId": {
                    "type": "string"
                  },
                  "recipients": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  }
                },
                "required": [
                  "proposalId",
                  "recipients"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "recipients": {
            "$ref": "#/components/schemas/Recipients2"
          },
          "newRecipients": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "bouncingRecipients": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "preview": {
            "$ref": "#/components/schemas/Preview"
          },
          "language": {
            "type": "string",
            "enum": [
              "en",
              "fr"
            ]
          },
          "senderAddress": {
            "type": "string"
          },
          "senderDisplayName": {
            "type": "string"
          },
          "replyToEmail": {
            "type": [
              "string",
              "null"
            ]
          },
          "transportReady": {
            "type": "boolean"
          },
          "blocked": {
            "type": [
              "string",
              "null"
            ]
          },
          "cap": {
            "$ref": "#/components/schemas/Cap"
          },
          "breaker": {
            "$ref": "#/components/schemas/Breaker"
          }
        },
        "required": [
          "invoiceId",
          "deliveries",
          "pending",
          "recipients",
          "newRecipients",
          "bouncingRecipients",
          "preview",
          "language",
          "senderAddress",
          "senderDisplayName",
          "replyToEmail",
          "transportReady",
          "blocked",
          "cap",
          "breaker"
        ],
        "additionalProperties": false
      },
      "GetReminderSettingsResponse": {
        "type": "object",
        "properties": {
          "entityId": {
            "type": "string"
          },
          "entityName": {
            "type": "string"
          },
          "timeZone": {
            "type": "string"
          },
          "steps": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "entityId": {
                  "type": "string"
                },
                "position": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                },
                "offsetDays": {
                  "type": "integer",
                  "minimum": -365,
                  "maximum": 365
                },
                "en": {
                  "$ref": "#/components/schemas/Preview"
                },
                "fr": {
                  "$ref": "#/components/schemas/Preview"
                },
                "active": {
                  "type": "boolean"
                },
                "sentCount": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                }
              },
              "required": [
                "id",
                "entityId",
                "position",
                "offsetDays",
                "en",
                "fr",
                "active",
                "sentCount"
              ],
              "additionalProperties": false
            }
          },
          "escalationEmail": {
            "type": [
              "string",
              "null"
            ]
          },
          "monthlyStatements": {
            "type": "boolean"
          },
          "balanceFloorMinor": {
            "type": "string",
            "pattern": "^-?\\d+$"
          },
          "blocked": {
            "type": [
              "string",
              "null"
            ]
          },
          "pausedCustomers": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "pausedInvoices": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          }
        },
        "required": [
          "entityId",
          "entityName",
          "timeZone",
          "steps",
          "escalationEmail",
          "monthlyStatements",
          "balanceFloorMinor",
          "blocked",
          "pausedCustomers",
          "pausedInvoices"
        ],
        "additionalProperties": false
      },
      "Head": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "field": {
              "type": "string"
            },
            "before": {
              "type": "string"
            },
            "after": {
              "type": "string"
            }
          },
          "required": [
            "field",
            "before",
            "after"
          ],
          "additionalProperties": false
        }
      },
      "History": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "id": {
              "type": "string"
            },
            "at": {
              "type": "string"
            },
            "action": {
              "type": "string"
            },
            "actorName": {
              "type": [
                "string",
                "null"
              ]
            },
            "actorType": {
              "type": "string",
              "enum": [
                "USER",
                "AGENT",
                "SYSTEM",
                "CUSTOMER"
              ]
            },
            "attribution": {
              "type": "string"
            },
            "targetType": {
              "type": "string"
            },
            "targetId": {
              "type": "string"
            },
            "requestId": {
              "type": [
                "string",
                "null"
              ]
            },
            "clientAddress": {
              "type": [
                "string",
                "null"
              ]
            },
            "before": {
              "anyOf": [
                {
                  "type": "object",
                  "propertyNames": {
                    "type": "string"
                  },
                  "additionalProperties": {}
                },
                {
                  "type": "null"
                }
              ]
            },
            "after": {
              "anyOf": [
                {
                  "type": "object",
                  "propertyNames": {
                    "type": "string"
                  },
                  "additionalProperties": {}
                },
                {
                  "type": "null"
                }
              ]
            },
            "door": {
              "anyOf": [
                {
                  "type": "string",
                  "enum": [
                    "web",
                    "rest",
                    "mcp"
                  ]
                },
                {
                  "type": "null"
                }
              ]
            },
            "operation": {
              "type": [
                "string",
                "null"
              ]
            },
            "connectedAppId": {
              "type": [
                "string",
                "null"
              ]
            },
            "undoGroupId": {
              "type": [
                "string",
                "null"
              ]
            },
            "confirmationId": {
              "type": [
                "string",
                "null"
              ]
            },
            "traceId": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          "required": [
            "id",
            "at",
            "action",
            "actorName",
            "actorType",
            "attribution",
            "targetType",
            "targetId",
            "requestId",
            "clientAddress",
            "door",
            "operation",
            "connectedAppId",
            "undoGroupId",
            "confirmationId",
            "traceId"
          ],
          "additionalProperties": false
        }
      },
      "Imported": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "position": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            },
            "placement": {
              "type": "string",
              "enum": [
                "AT_TIME",
                "START_OF_DAY",
                "ON_DAY",
                "IN_PERIOD"
              ]
            },
            "sortsAt": {
              "anyOf": [
                {
                  "type": "string",
                  "minLength": 20
                },
                {
                  "type": "null"
                }
              ]
            },
            "record": {
              "$ref": "#/components/schemas/Record"
            }
          },
          "required": [
            "position",
            "placement",
            "sortsAt",
            "record"
          ],
          "additionalProperties": false
        }
      },
      "Invoice2": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "number": {
                "type": "string"
              },
              "status": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "number",
              "status"
            ],
            "additionalProperties": false
          },
          {
            "type": "null"
          }
        ]
      },
      "Invoice3": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "number": {
            "type": "string"
          },
          "balanceMinor": {
            "type": "string",
            "pattern": "^-?\\d+$"
          },
          "dueDate": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "id",
          "number",
          "balanceMinor",
          "dueDate"
        ],
        "additionalProperties": false
      },
      "Invoiced": {
        "type": "object",
        "properties": {
          "netMinor": {
            "type": "string",
            "pattern": "^-?\\d+$"
          },
          "grossMinor": {
            "type": "string",
            "pattern": "^-?\\d+$"
          }
        },
        "required": [
          "netMinor",
          "grossMinor"
        ],
        "additionalProperties": false
      },
      "Job": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "ledgerId": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "x-extensible-enum": [
              "RECORD_IMPORT_READ",
              "RECORD_IMPORT_APPLY",
              "LIST_EXPORT",
              "AUDIT_PACKAGE",
              "YEAR_END_FILE",
              "PAYMENT_RUN_DISPATCH",
              "BULK_OPERATION",
              "UNDO_GROUP",
              "FULL_EXPORT",
              "WAREHOUSE_BACKFILL",
              "TEST_COPY",
              "WORKFLOW_RUN",
              "VENDOR_PRIVACY_PACK",
              "CAPITAL_LOOK_BACK",
              "VENDOR_PAPER_APPLY",
              "VENDOR_MERGE_APPROVAL",
              "SETTLEMENT_PROPOSE",
              "SALES_INVOICE_IMPORT",
              "WORKSPACE_INVITATIONS_SEND",
              "PROVIDER_TOKEN_REFRESH",
              "PROJECTION_REPLAY",
              "CHART_IMPORT_APPLY",
              "WORKSPACE_IMPORT_APPLY",
              "CSV_IMPORT",
              "CUSTOM_FIELD_INDEX",
              "PROMOTION_APPLY",
              "PERIOD_CLOSE"
            ],
            "description": "The values listed in `x-extensible-enum` are the ones known today. New values can appear without a new release, so handle an unknown one as you would an unexpected state, not as a failure to parse."
          },
          "state": {
            "type": "string",
            "enum": [
              "QUEUED",
              "RUNNING",
              "CANCELLING",
              "STALLED",
              "SUCCEEDED",
              "FAILED",
              "CANCELLED"
            ]
          },
          "done": {
            "type": "boolean"
          },
          "subject": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string"
                  },
                  "id": {
                    "type": "string"
                  },
                  "label": {
                    "type": "string"
                  }
                },
                "required": [
                  "type",
                  "id",
                  "label"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "startedBy": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "name"
            ],
            "additionalProperties": false
          },
          "app": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  }
                },
                "required": [
                  "id",
                  "name"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "door": {
            "type": "string",
            "enum": [
              "web",
              "rest",
              "mcp"
            ]
          },
          "progress": {
            "type": "object",
            "properties": {
              "unit": {
                "type": "string",
                "enum": [
                  "rows",
                  "records",
                  "items",
                  "sections",
                  "payments",
                  "tables"
                ]
              },
              "done": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "failed": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "total": {
                "anyOf": [
                  {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "percent": {
                "anyOf": [
                  {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 100
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "unit",
              "done",
              "failed",
              "total",
              "percent"
            ],
            "additionalProperties": false
          },
          "queuedAt": {
            "type": "string",
            "minLength": 20
          },
          "startedAt": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 20
              },
              {
                "type": "null"
              }
            ]
          },
          "finishedAt": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 20
              },
              {
                "type": "null"
              }
            ]
          },
          "heartbeatAt": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 20
              },
              {
                "type": "null"
              }
            ]
          },
          "queuePosition": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ]
          },
          "cancel": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "requestedAt": {
                    "type": "string",
                    "minLength": 20
                  },
                  "requestedBy": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string"
                      },
                      "name": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "id",
                      "name"
                    ],
                    "additionalProperties": false
                  },
                  "reason": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "late": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "requestedAt",
                  "requestedBy",
                  "reason",
                  "late"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "error": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "code": {
                    "$ref": "#/components/schemas/Code"
                  },
                  "message": {
                    "type": "string"
                  },
                  "remedy": {
                    "type": "string"
                  },
                  "retryable": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "code",
                  "message",
                  "remedy",
                  "retryable"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "result": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "x-extensible-enum": [
                      "RECORD_IMPORT_READ",
                      "RECORD_IMPORT_APPLY",
                      "LIST_EXPORT",
                      "AUDIT_PACKAGE",
                      "YEAR_END_FILE",
                      "PAYMENT_RUN_DISPATCH",
                      "BULK_OPERATION",
                      "UNDO_GROUP",
                      "FULL_EXPORT",
                      "WAREHOUSE_BACKFILL",
                      "TEST_COPY",
                      "WORKFLOW_RUN",
                      "VENDOR_PRIVACY_PACK",
                      "VENDOR_PAPER_APPLY",
                      "VENDOR_MERGE_APPROVAL",
                      "CAPITAL_LOOK_BACK",
                      "SETTLEMENT_PROPOSE",
                      "PROVIDER_TOKEN_REFRESH",
                      "WORKSPACE_INVITATIONS_SEND",
                      "PROJECTION_REPLAY",
                      "SALES_INVOICE_IMPORT",
                      "CHART_IMPORT_APPLY",
                      "WORKSPACE_IMPORT_APPLY",
                      "CSV_IMPORT",
                      "CUSTOM_FIELD_INDEX",
                      "PROMOTION_APPLY",
                      "PERIOD_CLOSE"
                    ],
                    "description": "Which kind of job this result is for. The values listed in `x-extensible-enum` are the ones known today. New values can appear without a new release, so handle an unknown one as you would an unexpected state, not as a failure to parse."
                  }
                },
                "required": [
                  "kind"
                ],
                "additionalProperties": true,
                "x-open-by-reference": true,
                "description": "What the job made: ids and counts. The fields depend on `kind`; `x-known-variants` lists the shapes known today. A kind added later is not a change to this contract.",
                "x-known-variants": [
                  {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "const": "RECORD_IMPORT_READ"
                      },
                      "batchId": {
                        "type": "string"
                      },
                      "rowsRead": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      }
                    },
                    "required": [
                      "kind",
                      "batchId",
                      "rowsRead"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "const": "RECORD_IMPORT_APPLY"
                      },
                      "importId": {
                        "type": "string"
                      },
                      "applied": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      },
                      "refused": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      }
                    },
                    "required": [
                      "kind",
                      "importId",
                      "applied",
                      "refused"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "const": "LIST_EXPORT"
                      },
                      "exportId": {
                        "type": "string"
                      },
                      "rows": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      }
                    },
                    "required": [
                      "kind",
                      "exportId",
                      "rows"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "const": "AUDIT_PACKAGE"
                      },
                      "packageId": {
                        "type": "string"
                      },
                      "records": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      }
                    },
                    "required": [
                      "kind",
                      "packageId",
                      "records"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "const": "YEAR_END_FILE"
                      },
                      "yearEndFileId": {
                        "type": "string"
                      },
                      "sections": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      }
                    },
                    "required": [
                      "kind",
                      "yearEndFileId",
                      "sections"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "const": "PAYMENT_RUN_DISPATCH"
                      },
                      "paymentRunId": {
                        "type": "string"
                      },
                      "submitted": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      },
                      "failed": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      }
                    },
                    "required": [
                      "kind",
                      "paymentRunId",
                      "submitted",
                      "failed"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "const": "BULK_OPERATION"
                      },
                      "operation": {
                        "type": "string"
                      },
                      "succeeded": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      },
                      "failed": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      },
                      "skipped": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      }
                    },
                    "required": [
                      "kind",
                      "operation",
                      "succeeded",
                      "failed",
                      "skipped"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "const": "UNDO_GROUP"
                      },
                      "undoGroupId": {
                        "type": "string"
                      },
                      "direction": {
                        "type": "string",
                        "enum": [
                          "undo",
                          "redo"
                        ]
                      },
                      "groupState": {
                        "type": "string",
                        "enum": [
                          "IN_PLACE",
                          "UNDONE",
                          "PARTLY_UNDONE",
                          "UNDO_PROPOSED"
                        ]
                      },
                      "undone": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      },
                      "refused": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      },
                      "staying": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      },
                      "notUndone": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      },
                      "refusals": {
                        "maxItems": 20,
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "code": {
                              "$ref": "#/components/schemas/Code"
                            },
                            "message": {
                              "type": "string"
                            },
                            "remedy": {
                              "type": "string"
                            },
                            "ordinal": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "operation": {
                              "type": "string"
                            },
                            "recordId": {
                              "type": [
                                "string",
                                "null"
                              ]
                            }
                          },
                          "required": [
                            "code",
                            "message",
                            "remedy",
                            "ordinal",
                            "operation",
                            "recordId"
                          ],
                          "additionalProperties": false
                        }
                      }
                    },
                    "required": [
                      "kind",
                      "undoGroupId",
                      "direction",
                      "groupState",
                      "undone",
                      "refused",
                      "staying",
                      "notUndone",
                      "refusals"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "const": "FULL_EXPORT"
                      },
                      "requestId": {
                        "type": "string"
                      },
                      "tables": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      }
                    },
                    "required": [
                      "kind",
                      "requestId",
                      "tables"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "const": "WAREHOUSE_BACKFILL"
                      },
                      "destinationId": {
                        "type": "string"
                      },
                      "tables": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      },
                      "rows": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      }
                    },
                    "required": [
                      "kind",
                      "destinationId",
                      "tables",
                      "rows"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "const": "TEST_COPY"
                      },
                      "testCopyId": {
                        "type": "string"
                      },
                      "tables": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      }
                    },
                    "required": [
                      "kind",
                      "testCopyId",
                      "tables"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "const": "WORKFLOW_RUN"
                      },
                      "workflowRunId": {
                        "type": "string"
                      },
                      "stepsDone": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      }
                    },
                    "required": [
                      "kind",
                      "workflowRunId",
                      "stepsDone"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "const": "VENDOR_PRIVACY_PACK"
                      },
                      "requestId": {
                        "type": "string"
                      },
                      "sections": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      }
                    },
                    "required": [
                      "kind",
                      "requestId",
                      "sections"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "const": "VENDOR_PAPER_APPLY"
                      },
                      "changed": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      }
                    },
                    "required": [
                      "kind",
                      "changed"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "const": "VENDOR_MERGE_APPROVAL"
                      },
                      "mergeId": {
                        "type": "string"
                      },
                      "billsMoved": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      }
                    },
                    "required": [
                      "kind",
                      "mergeId",
                      "billsMoved"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "examined": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      },
                      "raised": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      },
                      "alreadyRaised": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      },
                      "cleared": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      },
                      "belowFloor": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      },
                      "notCapital": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      },
                      "noRate": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      },
                      "kind": {
                        "type": "string",
                        "const": "CAPITAL_LOOK_BACK"
                      },
                      "entityId": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "examined",
                      "raised",
                      "alreadyRaised",
                      "cleared",
                      "belowFloor",
                      "notCapital",
                      "noRate",
                      "kind",
                      "entityId"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "const": "SETTLEMENT_PROPOSE"
                      },
                      "settlementId": {
                        "type": "string"
                      },
                      "proposed": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      },
                      "alreadyProposed": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      },
                      "taxMinor": {
                        "type": "string",
                        "pattern": "^-?\\d+$"
                      }
                    },
                    "required": [
                      "kind",
                      "settlementId",
                      "proposed",
                      "alreadyProposed",
                      "taxMinor"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "const": "PROVIDER_TOKEN_REFRESH"
                      },
                      "connectionId": {
                        "type": "string"
                      },
                      "provider": {
                        "type": "string",
                        "enum": [
                          "QBO",
                          "XERO"
                        ]
                      },
                      "outcome": {
                        "type": "string",
                        "enum": [
                          "REFRESHED",
                          "ALREADY_FRESH"
                        ]
                      }
                    },
                    "required": [
                      "kind",
                      "connectionId",
                      "provider",
                      "outcome"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "const": "WORKSPACE_INVITATIONS_SEND"
                      },
                      "importId": {
                        "type": "string"
                      },
                      "sent": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      },
                      "refused": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      },
                      "notConfigured": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      },
                      "queued": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      },
                      "throttled": {
                        "type": "boolean"
                      },
                      "resumesAt": {
                        "type": [
                          "string",
                          "null"
                        ]
                      }
                    },
                    "required": [
                      "kind",
                      "importId",
                      "sent",
                      "refused",
                      "notConfigured",
                      "queued",
                      "throttled",
                      "resumesAt"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "const": "PROJECTION_REPLAY"
                      },
                      "projection": {
                        "type": "string",
                        "enum": [
                          "entity-summary",
                          "document-index",
                          "webhooks",
                          "workflow-trigger"
                        ]
                      },
                      "appliedFrom": {
                        "type": "string"
                      },
                      "appliedThrough": {
                        "type": "string"
                      },
                      "applied": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      }
                    },
                    "required": [
                      "kind",
                      "projection",
                      "appliedFrom",
                      "appliedThrough",
                      "applied"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "const": "SALES_INVOICE_IMPORT"
                      },
                      "entityId": {
                        "type": "string"
                      },
                      "imported": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      },
                      "refused": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      },
                      "customersCreated": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      },
                      "refusals": {
                        "maxItems": 25,
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "row": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "number": {
                              "type": "string"
                            },
                            "reason": {
                              "type": "string"
                            },
                            "tax": {
                              "anyOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "chargedMinor": {
                                      "type": "string"
                                    },
                                    "determinedMinor": {
                                      "type": "string"
                                    }
                                  },
                                  "required": [
                                    "chargedMinor",
                                    "determinedMinor"
                                  ],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            }
                          },
                          "required": [
                            "row",
                            "number",
                            "reason",
                            "tax"
                          ],
                          "additionalProperties": false
                        }
                      }
                    },
                    "required": [
                      "kind",
                      "entityId",
                      "imported",
                      "refused",
                      "customersCreated",
                      "refusals"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "const": "CHART_IMPORT_APPLY"
                      },
                      "importId": {
                        "type": "string"
                      },
                      "accountsCreated": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      },
                      "dimensionValuesCreated": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      },
                      "dimensionPoliciesCreated": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      },
                      "dimensionTypeCode": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "declinedGroupCount": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      },
                      "accountsWithoutGifiCount": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      }
                    },
                    "required": [
                      "kind",
                      "importId",
                      "accountsCreated",
                      "dimensionValuesCreated",
                      "dimensionPoliciesCreated",
                      "dimensionTypeCode",
                      "declinedGroupCount",
                      "accountsWithoutGifiCount"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "const": "WORKSPACE_IMPORT_APPLY"
                      },
                      "importId": {
                        "type": "string"
                      },
                      "applied": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      },
                      "refused": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      },
                      "sendJobId": {
                        "type": [
                          "string",
                          "null"
                        ]
                      }
                    },
                    "required": [
                      "kind",
                      "importId",
                      "applied",
                      "refused",
                      "sendJobId"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "const": "CSV_IMPORT"
                      },
                      "connectionId": {
                        "type": "string"
                      },
                      "syncRunId": {
                        "type": "string"
                      },
                      "inserted": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      },
                      "duplicates": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      },
                      "total": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      },
                      "evidenceKey": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "kind",
                      "connectionId",
                      "syncRunId",
                      "inserted",
                      "duplicates",
                      "total",
                      "evidenceKey"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "const": "CUSTOM_FIELD_INDEX"
                      },
                      "definitionId": {
                        "type": "string"
                      },
                      "recordsIndexed": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      }
                    },
                    "required": [
                      "kind",
                      "definitionId",
                      "recordsIndexed"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "const": "PROMOTION_APPLY"
                      },
                      "promotionId": {
                        "type": "string"
                      },
                      "changesApplied": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      },
                      "indexJobsStarted": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      }
                    },
                    "required": [
                      "kind",
                      "promotionId",
                      "changesApplied",
                      "indexJobsStarted"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "const": "PERIOD_CLOSE"
                      },
                      "closePeriodId": {
                        "type": "string"
                      },
                      "periodYear": {
                        "type": "integer",
                        "minimum": -9007199254740991,
                        "maximum": 9007199254740991
                      },
                      "periodMonth": {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 12
                      },
                      "lockId": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "kind",
                      "closePeriodId",
                      "periodYear",
                      "periodMonth",
                      "lockId"
                    ],
                    "additionalProperties": false
                  }
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "undoGroupId": {
            "type": [
              "string",
              "null"
            ]
          },
          "traceId": {
            "type": "string",
            "pattern": "^[0-9a-f]{32}$"
          },
          "may": {
            "type": "object",
            "properties": {
              "cancel": {
                "type": "boolean"
              },
              "resume": {
                "type": "boolean"
              }
            },
            "required": [
              "cancel",
              "resume"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "id",
          "ledgerId",
          "kind",
          "state",
          "done",
          "subject",
          "startedBy",
          "app",
          "door",
          "progress",
          "queuedAt",
          "startedAt",
          "finishedAt",
          "heartbeatAt",
          "queuePosition",
          "cancel",
          "error",
          "result",
          "undoGroupId",
          "traceId",
          "may"
        ],
        "additionalProperties": false
      },
      "LastContact": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "at": {
                "type": "string",
                "minLength": 20
              },
              "kind": {
                "type": "string",
                "enum": [
                  "CALL",
                  "EMAIL",
                  "MEETING",
                  "LETTER",
                  "NOTE"
                ]
              },
              "outcome": {
                "type": "string",
                "enum": [
                  "NO_ANSWER",
                  "LEFT_MESSAGE",
                  "PROMISED_TO_PAY",
                  "PAYMENT_SENT",
                  "DISPUTED",
                  "WILL_CALL_BACK",
                  "OTHER"
                ]
              }
            },
            "required": [
              "at",
              "kind",
              "outcome"
            ],
            "additionalProperties": false
          },
          {
            "type": "null"
          }
        ]
      },
      "LastReplayOption1": {
        "type": "object",
        "properties": {
          "at": {
            "type": "string",
            "minLength": 20
          },
          "by": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "name"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "at",
          "by"
        ],
        "additionalProperties": false
      },
      "Lines2": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "kind": {
              "type": "string",
              "enum": [
                "ADDED",
                "REMOVED",
                "CHANGED"
              ]
            },
            "position": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            },
            "description": {
              "type": "string"
            },
            "cells": {
              "$ref": "#/components/schemas/Head"
            },
            "netBeforeMinor": {
              "anyOf": [
                {
                  "type": "string",
                  "pattern": "^-?\\d+$"
                },
                {
                  "type": "null"
                }
              ]
            },
            "netAfterMinor": {
              "anyOf": [
                {
                  "type": "string",
                  "pattern": "^-?\\d+$"
                },
                {
                  "type": "null"
                }
              ]
            }
          },
          "required": [
            "kind",
            "position",
            "description",
            "cells",
            "netBeforeMinor",
            "netAfterMinor"
          ],
          "additionalProperties": false
        }
      },
      "Lines5": {
        "minItems": 1,
        "maxItems": 100,
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "productId": {
              "type": "string",
              "minLength": 1
            },
            "description": {
              "type": "string",
              "minLength": 1,
              "maxLength": 500
            },
            "accountId": {
              "type": "string",
              "minLength": 1
            },
            "quantity": {
              "default": "1",
              "type": "string",
              "pattern": "^\\d{1,10}(\\.\\d{1,4})?$"
            },
            "unitPriceMinor": {
              "type": "string",
              "pattern": "^-?\\d+$"
            },
            "netMinor": {
              "type": "string",
              "pattern": "^-?\\d+$"
            },
            "supplyCategory": {
              "type": "string",
              "enum": [
                "GOODS",
                "SERVICES",
                "INTANGIBLE_PROPERTY",
                "REAL_PROPERTY"
              ]
            },
            "treatmentHint": {
              "type": "string",
              "enum": [
                "STANDARD",
                "ZERO_RATED",
                "EXEMPT",
                "OUT_OF_SCOPE"
              ]
            },
            "servicePeriodStart": {
              "type": "string",
              "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
            },
            "servicePeriodEnd": {
              "type": "string",
              "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
            },
            "discountBp": {
              "type": "integer",
              "minimum": 0,
              "maximum": 10000
            },
            "discountMinor": {
              "type": "string",
              "pattern": "^-?\\d+$"
            },
            "reserveConnection": {
              "type": "string",
              "enum": [
                "DELIVERED_TO_RESERVE",
                "PERFORMED_ON_RESERVE",
                "SITUATED_ON_RESERVE",
                "FOR_BAND_MANAGEMENT"
              ]
            },
            "taxOverride": {
              "type": "object",
              "properties": {
                "treatment": {
                  "type": "string",
                  "enum": [
                    "ZERO_RATED",
                    "EXEMPT",
                    "OUT_OF_SCOPE"
                  ]
                },
                "reason": {
                  "type": "string",
                  "maxLength": 500
                }
              },
              "required": [
                "treatment"
              ],
              "additionalProperties": false
            },
            "chargeKind": {
              "type": "string",
              "enum": [
                "FREIGHT",
                "FREIGHT_INSURANCE",
                "HOLDBACK_WITHHELD",
                "HOLDBACK_RELEASE"
              ]
            },
            "earnedLater": {
              "type": "string",
              "enum": [
                "OVER_PERIOD_BY_MONTH",
                "OVER_PERIOD_BY_DAY",
                "ON_DATE",
                "WHEN_RECOGNISED",
                "BY_MILESTONE"
              ]
            },
            "earnOn": {
              "type": "string",
              "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
            },
            "contractMilestoneId": {
              "type": "string",
              "minLength": 1
            },
            "hintReason": {
              "type": "string",
              "maxLength": 500
            },
            "dimensions": {
              "$ref": "#/components/schemas/Dimensions2"
            },
            "customFields": {
              "type": "object",
              "propertyNames": {
                "type": "string",
                "pattern": "^[a-z][a-z0-9_]{0,39}$"
              },
              "additionalProperties": {
                "anyOf": [
                  {
                    "type": "string",
                    "maxLength": 500
                  },
                  {
                    "type": "boolean"
                  }
                ]
              }
            }
          },
          "additionalProperties": false
        }
      },
      "Lines9": {
        "minItems": 1,
        "maxItems": 100,
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "productId": {
              "type": "string",
              "minLength": 1
            },
            "description": {
              "type": "string",
              "minLength": 1,
              "maxLength": 500
            },
            "accountId": {
              "type": "string",
              "minLength": 1
            },
            "quantity": {
              "default": "1",
              "type": "string",
              "pattern": "^\\d{1,10}(\\.\\d{1,4})?$"
            },
            "unitPriceMinor": {
              "type": "string",
              "pattern": "^-?\\d+$"
            },
            "supplyCategory": {
              "type": "string",
              "enum": [
                "GOODS",
                "SERVICES",
                "INTANGIBLE_PROPERTY",
                "REAL_PROPERTY"
              ]
            },
            "treatmentHint": {
              "type": "string",
              "enum": [
                "STANDARD",
                "ZERO_RATED",
                "EXEMPT",
                "OUT_OF_SCOPE"
              ]
            },
            "dimensions": {
              "maxItems": 10,
              "type": "array",
              "items": {
                "$ref": "#/components/schemas/DimensionsItem"
              }
            },
            "servicePeriodMonths": {
              "type": "integer",
              "minimum": 1,
              "maximum": 600
            }
          },
          "additionalProperties": false
        }
      },
      "Links": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "id": {
              "type": "string"
            },
            "provider": {
              "type": "string",
              "enum": [
                "STRIPE",
                "HUBSPOT",
                "QBO",
                "XERO"
              ]
            },
            "externalId": {
              "type": "string"
            },
            "externalLabel": {
              "type": [
                "string",
                "null"
              ]
            },
            "source": {
              "type": "string",
              "enum": [
                "EMAIL_MATCH",
                "IMPORT",
                "CHECKOUT",
                "MANUAL"
              ]
            },
            "linkedBy": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                }
              },
              "required": [
                "id",
                "name"
              ],
              "additionalProperties": false
            },
            "linkedAt": {
              "type": "string",
              "minLength": 20
            }
          },
          "required": [
            "id",
            "provider",
            "externalId",
            "externalLabel",
            "source",
            "linkedBy",
            "linkedAt"
          ],
          "additionalProperties": false
        }
      },
      "ListCollectionActivitiesResponseItem": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "customerId": {
            "type": "string"
          },
          "invoice": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "number": {
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                },
                "required": [
                  "id",
                  "number"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "kind": {
            "type": "string",
            "enum": [
              "CALL",
              "EMAIL",
              "MEETING",
              "LETTER",
              "NOTE"
            ]
          },
          "occurredAt": {
            "type": "string",
            "minLength": 20
          },
          "contactName": {
            "type": [
              "string",
              "null"
            ]
          },
          "summary": {
            "type": "string"
          },
          "outcome": {
            "type": "string",
            "enum": [
              "NO_ANSWER",
              "LEFT_MESSAGE",
              "PROMISED_TO_PAY",
              "PAYMENT_SENT",
              "DISPUTED",
              "WILL_CALL_BACK",
              "OTHER"
            ]
          },
          "promisedOn": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
              },
              {
                "type": "null"
              }
            ]
          },
          "promisedAmountMinor": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^-?\\d+$"
              },
              {
                "type": "null"
              }
            ]
          },
          "promisedCurrency": {
            "type": [
              "string",
              "null"
            ]
          },
          "correctsId": {
            "type": [
              "string",
              "null"
            ]
          },
          "correctedById": {
            "type": [
              "string",
              "null"
            ]
          },
          "recordedBy": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "name"
            ],
            "additionalProperties": false
          },
          "recordedAt": {
            "type": "string",
            "minLength": 20
          }
        },
        "required": [
          "id",
          "customerId",
          "invoice",
          "kind",
          "occurredAt",
          "contactName",
          "summary",
          "outcome",
          "promisedOn",
          "promisedAmountMinor",
          "promisedCurrency",
          "correctsId",
          "correctedById",
          "recordedBy",
          "recordedAt"
        ],
        "additionalProperties": false
      },
      "ListCustomerPricesResponseItem": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "customerId": {
            "type": "string"
          },
          "product": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "code": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "code",
              "name"
            ],
            "additionalProperties": false
          },
          "priceMinor": {
            "type": "string",
            "pattern": "^-?\\d+$"
          },
          "currency": {
            "type": "string"
          },
          "validFrom": {
            "type": "string",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
          },
          "validTo": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
              },
              {
                "type": "null"
              }
            ]
          },
          "inUse": {
            "type": "boolean"
          },
          "createdBy": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "name"
            ],
            "additionalProperties": false
          },
          "createdAt": {
            "type": "string",
            "minLength": 20
          },
          "updatedBy": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  }
                },
                "required": [
                  "id",
                  "name"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "updatedAt": {
            "type": "string",
            "minLength": 20
          }
        },
        "required": [
          "id",
          "customerId",
          "product",
          "priceMinor",
          "currency",
          "validFrom",
          "validTo",
          "inUse",
          "createdBy",
          "createdAt",
          "updatedBy",
          "updatedAt"
        ],
        "additionalProperties": false
      },
      "ListDisputesResponseItem": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "invoiceId": {
            "type": "string"
          },
          "invoiceNumber": {
            "type": "string"
          },
          "customerId": {
            "type": "string"
          },
          "customerName": {
            "type": "string"
          },
          "entityId": {
            "type": "string"
          },
          "entityName": {
            "type": "string"
          },
          "currency": {
            "type": "string"
          },
          "balanceMinor": {
            "type": "string",
            "pattern": "^-?\\d+$"
          },
          "reason": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "OPEN",
              "RESOLVED"
            ]
          },
          "raisedAt": {
            "type": "string",
            "minLength": 20
          },
          "resolvedAt": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 20
              },
              {
                "type": "null"
              }
            ]
          },
          "resolvedBy": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "name": {
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                },
                "required": [
                  "id",
                  "name"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "resolution": {
            "type": [
              "string",
              "null"
            ]
          },
          "pauseId": {
            "type": [
              "string",
              "null"
            ]
          },
          "questionId": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "id",
          "invoiceId",
          "invoiceNumber",
          "customerId",
          "customerName",
          "entityId",
          "entityName",
          "currency",
          "balanceMinor",
          "reason",
          "status",
          "raisedAt",
          "resolvedAt",
          "resolvedBy",
          "resolution",
          "pauseId",
          "questionId"
        ],
        "additionalProperties": false
      },
      "ListExemptionCertificatesResponseItem": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "customerId": {
            "type": "string"
          },
          "documentId": {
            "type": "string"
          },
          "scope": {
            "type": "string",
            "enum": [
              "PROVINCIAL_SALES_TAX",
              "GST_HST_RELIEF",
              "NON_RESIDENT_STATUS",
              "EXPORT_PROOF",
              "INDIAN_ACT_S87"
            ]
          },
          "jurisdiction": {
            "type": "string"
          },
          "holderKind": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "INDIVIDUAL",
                  "BAND",
                  "BAND_EMPOWERED_ENTITY",
                  "INCORPORATED_BAND_EMPOWERED_ENTITY"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "purpose": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "BAND_MANAGEMENT",
                  "REAL_PROPERTY_ON_RESERVE"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "bandName": {
            "type": [
              "string",
              "null"
            ]
          },
          "bandNumber": {
            "type": [
              "string",
              "null"
            ]
          },
          "certificateNumber": {
            "type": [
              "string",
              "null"
            ]
          },
          "hasRegistryNumber": {
            "type": "boolean"
          },
          "effectiveFrom": {
            "type": "string",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
          },
          "expiresOn": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
              },
              {
                "type": "null"
              }
            ]
          },
          "state": {
            "type": "string",
            "enum": [
              "CURRENT",
              "EXPIRING",
              "EXPIRED",
              "NOT_YET",
              "REMOVED"
            ]
          },
          "recordedBy": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "name"
            ],
            "additionalProperties": false
          },
          "createdAt": {
            "type": "string",
            "minLength": 20
          },
          "removedAt": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 20
              },
              {
                "type": "null"
              }
            ]
          },
          "removedBy": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  }
                },
                "required": [
                  "id",
                  "name"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "removeReason": {
            "type": [
              "string",
              "null"
            ]
          },
          "memo": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "id",
          "customerId",
          "documentId",
          "scope",
          "jurisdiction",
          "holderKind",
          "purpose",
          "bandName",
          "bandNumber",
          "certificateNumber",
          "hasRegistryNumber",
          "effectiveFrom",
          "expiresOn",
          "state",
          "recordedBy",
          "createdAt",
          "removedAt",
          "removedBy",
          "removeReason",
          "memo"
        ],
        "additionalProperties": false
      },
      "ListProductsResponseItem": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "code": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "customFields": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "boolean"
                },
                {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                }
              ]
            }
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "supplyCategory": {
            "type": "string",
            "enum": [
              "GOODS",
              "SERVICES",
              "INTANGIBLE_PROPERTY",
              "REAL_PROPERTY"
            ]
          },
          "treatmentHint": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "STANDARD",
                  "ZERO_RATED",
                  "EXEMPT",
                  "OUT_OF_SCOPE",
                  "RELIEVED"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "treatmentReason": {
            "type": [
              "string",
              "null"
            ]
          },
          "treatmentCondition": {
            "type": "string",
            "enum": [
              "ANY_RECIPIENT",
              "NON_RESIDENT_RECIPIENT"
            ]
          },
          "revenueAccount": {
            "$ref": "#/components/schemas/Account"
          },
          "kind": {
            "type": "string",
            "enum": [
              "REVENUE",
              "NON_REVENUE"
            ]
          },
          "countryOfOrigin": {
            "type": [
              "string",
              "null"
            ]
          },
          "hsCode": {
            "type": [
              "string",
              "null"
            ]
          },
          "chargeKind": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "FREIGHT",
                  "FREIGHT_INSURANCE",
                  "HOLDBACK_WITHHELD",
                  "HOLDBACK_RELEASE"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "deferredAccount": {
            "$ref": "#/components/schemas/Account"
          },
          "unitPriceMinor": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^-?\\d+$"
              },
              {
                "type": "null"
              }
            ]
          },
          "currency": {
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "ACTIVE",
              "ARCHIVED"
            ]
          },
          "archivedAt": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 20
              },
              {
                "type": "null"
              }
            ]
          },
          "archivedBy": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  }
                },
                "required": [
                  "id",
                  "name"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "archiveReason": {
            "type": [
              "string",
              "null"
            ]
          },
          "createdBy": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "name"
            ],
            "additionalProperties": false
          },
          "createdAt": {
            "type": "string",
            "minLength": 20
          },
          "updatedAt": {
            "type": "string",
            "minLength": 20
          }
        },
        "required": [
          "id",
          "code",
          "name",
          "description",
          "supplyCategory",
          "treatmentHint",
          "treatmentReason",
          "treatmentCondition",
          "revenueAccount",
          "kind",
          "countryOfOrigin",
          "hsCode",
          "chargeKind",
          "deferredAccount",
          "unitPriceMinor",
          "currency",
          "status",
          "archivedAt",
          "archivedBy",
          "archiveReason",
          "createdBy",
          "createdAt",
          "updatedAt"
        ],
        "additionalProperties": false
      },
      "ListReminderPausesResponseItem": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "entityId": {
            "type": "string"
          },
          "customerId": {
            "type": [
              "string",
              "null"
            ]
          },
          "invoiceId": {
            "type": [
              "string",
              "null"
            ]
          },
          "customerName": {
            "type": [
              "string",
              "null"
            ]
          },
          "invoiceNumber": {
            "type": [
              "string",
              "null"
            ]
          },
          "reason": {
            "type": "string"
          },
          "pausedBy": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  }
                },
                "required": [
                  "id",
                  "name"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "pausedAt": {
            "type": "string",
            "minLength": 20
          },
          "liftedBy": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  }
                },
                "required": [
                  "id",
                  "name"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "liftedAt": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 20
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "entityId",
          "customerId",
          "invoiceId",
          "customerName",
          "invoiceNumber",
          "reason",
          "pausedBy",
          "pausedAt",
          "liftedBy",
          "liftedAt"
        ],
        "additionalProperties": false
      },
      "Mapping": {
        "type": "object",
        "propertyNames": {
          "$ref": "#/components/schemas/MappingValue"
        },
        "additionalProperties": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991
        }
      },
      "MappingValue": {
        "type": "string",
        "enum": [
          "number",
          "customer",
          "region",
          "issueDate",
          "dueDate",
          "description",
          "net",
          "tax",
          "total",
          "accountCode",
          "externalId",
          "email",
          "currency",
          "paidOn",
          "paid",
          "paymentReference",
          "paymentMethod"
        ]
      },
      "Mark": {
        "type": "object",
        "properties": {
          "importId": {
            "type": "string"
          },
          "lineNumber": {
            "type": "integer",
            "minimum": 1,
            "maximum": 9007199254740991
          },
          "documentId": {
            "type": "string"
          },
          "fileName": {
            "type": "string"
          },
          "fileSha256": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$"
          },
          "sourceSystem": {
            "type": "string",
            "enum": [
              "QUICKBOOKS_ONLINE",
              "QUICKBOOKS_DESKTOP",
              "XERO",
              "SAGE_50",
              "SPREADSHEET",
              "OTHER"
            ]
          },
          "sourceSystemLabel": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 80
              },
              {
                "type": "null"
              }
            ]
          },
          "sourceRef": {
            "type": [
              "string",
              "null"
            ]
          },
          "uploadedBy": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "name"
            ],
            "additionalProperties": false
          },
          "approvedBy": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "name"
            ],
            "additionalProperties": false
          },
          "approvedAt": {
            "type": "string",
            "minLength": 20
          }
        },
        "required": [
          "importId",
          "lineNumber",
          "documentId",
          "fileName",
          "fileSha256",
          "sourceSystem",
          "sourceSystemLabel",
          "sourceRef",
          "uploadedBy",
          "approvedBy",
          "approvedAt"
        ],
        "additionalProperties": false
      },
      "Milestones": {
        "minItems": 1,
        "maxItems": 50,
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "name": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            },
            "percentBp": {
              "type": "integer",
              "minimum": 1,
              "maximum": 10000
            }
          },
          "required": [
            "name",
            "percentBp"
          ],
          "additionalProperties": false
        }
      },
      "NonCashLines": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "accountId": {
              "type": "string"
            },
            "code": {
              "type": "string"
            },
            "name": {
              "type": "string"
            },
            "amountMinor": {
              "type": "string",
              "pattern": "^-?\\d+$"
            }
          },
          "required": [
            "accountId",
            "code",
            "name",
            "amountMinor"
          ],
          "additionalProperties": false
        }
      },
      "PaymentTerms": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "netDays": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "discountBp": {
                "anyOf": [
                  {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "discountDays": {
                "anyOf": [
                  {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "interestMonthlyBp": {
                "anyOf": [
                  {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "interestAnnualBp": {
                "anyOf": [
                  {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "isDefault": {
                "type": "boolean"
              },
              "appliesTo": {
                "type": "string",
                "enum": [
                  "SALES",
                  "PURCHASES",
                  "BOTH"
                ]
              }
            },
            "required": [
              "id",
              "name",
              "netDays",
              "discountBp",
              "discountDays",
              "interestMonthlyBp",
              "interestAnnualBp",
              "isDefault",
              "appliesTo"
            ],
            "additionalProperties": false
          },
          {
            "type": "null"
          }
        ]
      },
      "PreTickedItem": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "number": {
            "type": "string"
          },
          "balanceMinor": {
            "type": "string",
            "pattern": "^-?\\d+$"
          },
          "dueDate": {
            "type": [
              "string",
              "null"
            ]
          },
          "reason": {
            "type": "string",
            "minLength": 1
          },
          "signals": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "REFERENCE",
                "AMOUNT",
                "CUSTOMER_NAME",
                "INVOICE_SUM",
                "OLDEST_FIRST"
              ]
            }
          },
          "score": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100
          }
        },
        "required": [
          "id",
          "number",
          "balanceMinor",
          "dueDate",
          "reason",
          "signals",
          "score"
        ],
        "additionalProperties": false
      },
      "Preview": {
        "type": "object",
        "properties": {
          "subject": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "body": {
            "type": "string",
            "minLength": 1,
            "maxLength": 4000
          }
        },
        "required": [
          "subject",
          "body"
        ],
        "additionalProperties": false
      },
      "ProblemDetails": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "status": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "detail": {
            "type": "string"
          },
          "code": {
            "$ref": "#/components/schemas/Code"
          },
          "requestId": {
            "type": [
              "string",
              "null"
            ]
          },
          "fields": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {
              "type": "string"
            }
          },
          "remedy": {
            "type": "string"
          },
          "maxBytes": {
            "type": "integer",
            "exclusiveMinimum": 0,
            "maximum": 9007199254740991
          }
        },
        "required": [
          "type",
          "title",
          "status",
          "detail",
          "code"
        ],
        "additionalProperties": false
      },
      "Proposal2": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "status": {
                "type": "string"
              },
              "submittedAt": {
                "type": "string",
                "minLength": 20
              },
              "submittedBy": {
                "anyOf": [
                  {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string"
                      },
                      "name": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "id",
                      "name"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "id",
              "status",
              "submittedAt",
              "submittedBy"
            ],
            "additionalProperties": false
          },
          {
            "type": "null"
          }
        ]
      },
      "Reading2": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "state": {
                "type": "string",
                "enum": [
                  "READING",
                  "READ",
                  "REFUSED"
                ]
              },
              "note": {
                "default": null,
                "anyOf": [
                  {
                    "type": "string",
                    "maxLength": 1000
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "pages": {
                "default": null,
                "anyOf": [
                  {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "ocr": {
                "default": false,
                "type": "boolean"
              },
              "origin": {
                "default": null,
                "anyOf": [
                  {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "const": "EMAIL"
                      },
                      "address": {
                        "type": "string",
                        "maxLength": 320
                      },
                      "sender": {
                        "type": "string",
                        "maxLength": 320
                      },
                      "receivedAt": {
                        "type": "string",
                        "maxLength": 40
                      },
                      "documentId": {
                        "type": "string",
                        "maxLength": 64
                      }
                    },
                    "required": [
                      "kind",
                      "address",
                      "sender",
                      "receivedAt",
                      "documentId"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "state",
              "note",
              "pages",
              "ocr",
              "origin"
            ],
            "additionalProperties": false
          },
          {
            "type": "null"
          }
        ]
      },
      "RecipientPlace": {
        "type": "object",
        "properties": {
          "country": {
            "type": "string",
            "pattern": "^[A-Z]{2}$"
          },
          "region": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^(CA|US)-[A-Z]{2}$"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "country",
          "region"
        ],
        "additionalProperties": false
      },
      "Recipients2": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "email": {
              "type": "string"
            },
            "role": {
              "type": "string",
              "enum": [
                "BILLING",
                "CC",
                "ESCALATION"
              ]
            }
          },
          "required": [
            "email",
            "role"
          ],
          "additionalProperties": false
        }
      },
      "Record": {
        "oneOf": [
          {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "occurredOn": {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
              },
              "occurredAt": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 20
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "occurredZone": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "periodYear": {
                "anyOf": [
                  {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "periodMonth": {
                "anyOf": [
                  {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "subject": {
                "type": "string"
              },
              "entityId": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "entityName": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "payloadVersion": {
                "type": "integer",
                "minimum": 1,
                "maximum": 9007199254740991
              },
              "mark": {
                "$ref": "#/components/schemas/Mark"
              },
              "createdAt": {
                "type": "string",
                "minLength": 20
              },
              "vendor": {
                "$ref": "#/components/schemas/Vendor"
              },
              "kind": {
                "type": "string",
                "const": "AUDIT_LINE"
              },
              "payload": {
                "type": "object",
                "properties": {
                  "actorName": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 500
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "actorEmail": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 500
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "action": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 500
                  },
                  "targetDescription": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 500
                  },
                  "amountMinor": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^-?\\d+$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "currency": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^[A-Z]{3}$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "before": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 500
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "after": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 500
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "note": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 500
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "zoneAssumed": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "actorName",
                  "actorEmail",
                  "action",
                  "targetDescription",
                  "amountMinor",
                  "currency",
                  "before",
                  "after",
                  "note",
                  "zoneAssumed"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "id",
              "occurredOn",
              "occurredAt",
              "occurredZone",
              "periodYear",
              "periodMonth",
              "subject",
              "entityId",
              "entityName",
              "payloadVersion",
              "mark",
              "createdAt",
              "vendor",
              "kind",
              "payload"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "occurredOn": {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
              },
              "occurredAt": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 20
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "occurredZone": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "periodYear": {
                "anyOf": [
                  {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "periodMonth": {
                "anyOf": [
                  {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "subject": {
                "type": "string"
              },
              "entityId": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "entityName": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "payloadVersion": {
                "type": "integer",
                "minimum": 1,
                "maximum": 9007199254740991
              },
              "mark": {
                "$ref": "#/components/schemas/Mark"
              },
              "createdAt": {
                "type": "string",
                "minLength": 20
              },
              "vendor": {
                "$ref": "#/components/schemas/Vendor"
              },
              "kind": {
                "type": "string",
                "const": "CONTROL_FIRING"
              },
              "payload": {
                "type": "object",
                "properties": {
                  "controlName": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 500
                  },
                  "outcome": {
                    "type": "string",
                    "enum": [
                      "AUTO_APPROVED",
                      "ROUTED",
                      "REFUSED",
                      "CHANGED"
                    ]
                  },
                  "subjectRef": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 500
                  },
                  "amountMinor": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^-?\\d+$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "currency": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^[A-Z]{3}$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "actorName": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 500
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "reason": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 500
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "controlName",
                  "outcome",
                  "subjectRef",
                  "amountMinor",
                  "currency",
                  "actorName",
                  "reason"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "id",
              "occurredOn",
              "occurredAt",
              "occurredZone",
              "periodYear",
              "periodMonth",
              "subject",
              "entityId",
              "entityName",
              "payloadVersion",
              "mark",
              "createdAt",
              "vendor",
              "kind",
              "payload"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "occurredOn": {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
              },
              "occurredAt": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 20
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "occurredZone": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "periodYear": {
                "anyOf": [
                  {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "periodMonth": {
                "anyOf": [
                  {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "subject": {
                "type": "string"
              },
              "entityId": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "entityName": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "payloadVersion": {
                "type": "integer",
                "minimum": 1,
                "maximum": 9007199254740991
              },
              "mark": {
                "$ref": "#/components/schemas/Mark"
              },
              "createdAt": {
                "type": "string",
                "minLength": 20
              },
              "vendor": {
                "$ref": "#/components/schemas/Vendor"
              },
              "kind": {
                "type": "string",
                "const": "PERIOD_LOCK"
              },
              "payload": {
                "type": "object",
                "properties": {
                  "lockedThrough": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "scope": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 500
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "subledger": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 500
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "lockedByName": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 500
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "lockedOn": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "unlockedOn": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "unlockedByName": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 500
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "reason": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 500
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "lockedThrough",
                  "scope",
                  "subledger",
                  "lockedByName",
                  "lockedOn",
                  "unlockedOn",
                  "unlockedByName",
                  "reason"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "id",
              "occurredOn",
              "occurredAt",
              "occurredZone",
              "periodYear",
              "periodMonth",
              "subject",
              "entityId",
              "entityName",
              "payloadVersion",
              "mark",
              "createdAt",
              "vendor",
              "kind",
              "payload"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "occurredOn": {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
              },
              "occurredAt": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 20
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "occurredZone": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "periodYear": {
                "anyOf": [
                  {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "periodMonth": {
                "anyOf": [
                  {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "subject": {
                "type": "string"
              },
              "entityId": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "entityName": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "payloadVersion": {
                "type": "integer",
                "minimum": 1,
                "maximum": 9007199254740991
              },
              "mark": {
                "$ref": "#/components/schemas/Mark"
              },
              "createdAt": {
                "type": "string",
                "minLength": 20
              },
              "vendor": {
                "$ref": "#/components/schemas/Vendor"
              },
              "kind": {
                "type": "string",
                "const": "REPORT_PACK"
              },
              "payload": {
                "type": "object",
                "properties": {
                  "title": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 500
                  },
                  "statusAsIssued": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 500
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "issuedOn": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "issuedByName": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 500
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "title",
                  "statusAsIssued",
                  "issuedOn",
                  "issuedByName"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "id",
              "occurredOn",
              "occurredAt",
              "occurredZone",
              "periodYear",
              "periodMonth",
              "subject",
              "entityId",
              "entityName",
              "payloadVersion",
              "mark",
              "createdAt",
              "vendor",
              "kind",
              "payload"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "occurredOn": {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
              },
              "occurredAt": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 20
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "occurredZone": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "periodYear": {
                "anyOf": [
                  {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "periodMonth": {
                "anyOf": [
                  {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "subject": {
                "type": "string"
              },
              "entityId": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "entityName": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "payloadVersion": {
                "type": "integer",
                "minimum": 1,
                "maximum": 9007199254740991
              },
              "mark": {
                "$ref": "#/components/schemas/Mark"
              },
              "createdAt": {
                "type": "string",
                "minLength": 20
              },
              "vendor": {
                "$ref": "#/components/schemas/Vendor"
              },
              "kind": {
                "type": "string",
                "const": "SLIP_FILE"
              },
              "payload": {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "enum": [
                      "T4A",
                      "T5018"
                    ]
                  },
                  "taxYear": {
                    "type": "integer",
                    "minimum": 1900,
                    "maximum": 2200
                  },
                  "periodEnd": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  },
                  "slipCount": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 1000000
                  },
                  "totalMinor": {
                    "type": "string",
                    "pattern": "^-?\\d+$"
                  },
                  "reportType": {
                    "anyOf": [
                      {
                        "type": "string",
                        "enum": [
                          "ORIGINAL",
                          "AMENDMENT"
                        ]
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "filedOn": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "confirmationNumber": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 500
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "kind",
                  "taxYear",
                  "periodEnd",
                  "slipCount",
                  "totalMinor",
                  "reportType",
                  "filedOn",
                  "confirmationNumber"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "id",
              "occurredOn",
              "occurredAt",
              "occurredZone",
              "periodYear",
              "periodMonth",
              "subject",
              "entityId",
              "entityName",
              "payloadVersion",
              "mark",
              "createdAt",
              "vendor",
              "kind",
              "payload"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "occurredOn": {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
              },
              "occurredAt": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 20
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "occurredZone": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "periodYear": {
                "anyOf": [
                  {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "periodMonth": {
                "anyOf": [
                  {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "subject": {
                "type": "string"
              },
              "entityId": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "entityName": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "payloadVersion": {
                "type": "integer",
                "minimum": 1,
                "maximum": 9007199254740991
              },
              "mark": {
                "$ref": "#/components/schemas/Mark"
              },
              "createdAt": {
                "type": "string",
                "minLength": 20
              },
              "vendor": {
                "$ref": "#/components/schemas/Vendor"
              },
              "kind": {
                "type": "string",
                "const": "FX_RATE"
              },
              "payload": {
                "type": "object",
                "properties": {
                  "base": {
                    "type": "string",
                    "pattern": "^[A-Z]{3}$"
                  },
                  "quote": {
                    "type": "string",
                    "pattern": "^[A-Z]{3}$"
                  },
                  "rate": {
                    "type": "string",
                    "pattern": "^\\d{1,6}\\.\\d{6}$"
                  },
                  "rateSourceAsNamed": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 500
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "note": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 500
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "base",
                  "quote",
                  "rate",
                  "rateSourceAsNamed",
                  "note"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "id",
              "occurredOn",
              "occurredAt",
              "occurredZone",
              "periodYear",
              "periodMonth",
              "subject",
              "entityId",
              "entityName",
              "payloadVersion",
              "mark",
              "createdAt",
              "vendor",
              "kind",
              "payload"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "occurredOn": {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
              },
              "occurredAt": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 20
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "occurredZone": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "periodYear": {
                "anyOf": [
                  {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "periodMonth": {
                "anyOf": [
                  {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "subject": {
                "type": "string"
              },
              "entityId": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "entityName": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "payloadVersion": {
                "type": "integer",
                "minimum": 1,
                "maximum": 9007199254740991
              },
              "mark": {
                "$ref": "#/components/schemas/Mark"
              },
              "createdAt": {
                "type": "string",
                "minLength": 20
              },
              "vendor": {
                "$ref": "#/components/schemas/Vendor"
              },
              "kind": {
                "type": "string",
                "const": "SCHEDULE"
              },
              "payload": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 500
                  },
                  "templateType": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 500
                  },
                  "intervalText": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 500
                  },
                  "interval": {
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "unit": {
                            "type": "string",
                            "enum": [
                              "DAY",
                              "WEEK",
                              "MONTH",
                              "YEAR"
                            ]
                          },
                          "every": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 366
                          }
                        },
                        "required": [
                          "unit",
                          "every"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "previousDate": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "nextDateInSource": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "endDate": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "counterpartyName": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 500
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "amountMinor": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^-?\\d+$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "currency": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^[A-Z]{3}$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "activeInSource": {
                    "type": [
                      "boolean",
                      "null"
                    ]
                  }
                },
                "required": [
                  "name",
                  "templateType",
                  "intervalText",
                  "interval",
                  "previousDate",
                  "nextDateInSource",
                  "endDate",
                  "counterpartyName",
                  "amountMinor",
                  "currency",
                  "activeInSource"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "id",
              "occurredOn",
              "occurredAt",
              "occurredZone",
              "periodYear",
              "periodMonth",
              "subject",
              "entityId",
              "entityName",
              "payloadVersion",
              "mark",
              "createdAt",
              "vendor",
              "kind",
              "payload"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "occurredOn": {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
              },
              "occurredAt": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 20
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "occurredZone": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "periodYear": {
                "anyOf": [
                  {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "periodMonth": {
                "anyOf": [
                  {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "subject": {
                "type": "string"
              },
              "entityId": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "entityName": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "payloadVersion": {
                "type": "integer",
                "minimum": 1,
                "maximum": 9007199254740991
              },
              "mark": {
                "$ref": "#/components/schemas/Mark"
              },
              "createdAt": {
                "type": "string",
                "minLength": 20
              },
              "vendor": {
                "$ref": "#/components/schemas/Vendor"
              },
              "kind": {
                "type": "string",
                "const": "QUEUE_DECISION"
              },
              "payload": {
                "type": "object",
                "properties": {
                  "recordType": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 500
                  },
                  "reference": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 500
                  },
                  "decision": {
                    "type": "string",
                    "enum": [
                      "APPROVED",
                      "DECLINED"
                    ]
                  },
                  "decidedByName": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 500
                  },
                  "submittedByName": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 500
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "amountMinor": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^-?\\d+$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "currency": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^[A-Z]{3}$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "reason": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 500
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "recordType",
                  "reference",
                  "decision",
                  "decidedByName",
                  "submittedByName",
                  "amountMinor",
                  "currency",
                  "reason"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "id",
              "occurredOn",
              "occurredAt",
              "occurredZone",
              "periodYear",
              "periodMonth",
              "subject",
              "entityId",
              "entityName",
              "payloadVersion",
              "mark",
              "createdAt",
              "vendor",
              "kind",
              "payload"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "occurredOn": {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
              },
              "occurredAt": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 20
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "occurredZone": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "periodYear": {
                "anyOf": [
                  {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "periodMonth": {
                "anyOf": [
                  {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "subject": {
                "type": "string"
              },
              "entityId": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "entityName": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "payloadVersion": {
                "type": "integer",
                "minimum": 1,
                "maximum": 9007199254740991
              },
              "mark": {
                "$ref": "#/components/schemas/Mark"
              },
              "createdAt": {
                "type": "string",
                "minLength": 20
              },
              "vendor": {
                "$ref": "#/components/schemas/Vendor"
              },
              "kind": {
                "type": "string",
                "const": "TAX_OVERRIDE"
              },
              "payload": {
                "type": "object",
                "properties": {
                  "reference": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 500
                  },
                  "engineOrDefaultTreatment": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 500
                  },
                  "chosenTreatment": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 500
                  },
                  "reason": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 500
                  },
                  "taxAmountMinor": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^-?\\d+$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "currency": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^[A-Z]{3}$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "registrationNumber": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 500
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "overriddenByName": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 500
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "reference",
                  "engineOrDefaultTreatment",
                  "chosenTreatment",
                  "reason",
                  "taxAmountMinor",
                  "currency",
                  "registrationNumber",
                  "overriddenByName"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "id",
              "occurredOn",
              "occurredAt",
              "occurredZone",
              "periodYear",
              "periodMonth",
              "subject",
              "entityId",
              "entityName",
              "payloadVersion",
              "mark",
              "createdAt",
              "vendor",
              "kind",
              "payload"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "occurredOn": {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
              },
              "occurredAt": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 20
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "occurredZone": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "periodYear": {
                "anyOf": [
                  {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "periodMonth": {
                "anyOf": [
                  {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "subject": {
                "type": "string"
              },
              "entityId": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "entityName": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "payloadVersion": {
                "type": "integer",
                "minimum": 1,
                "maximum": 9007199254740991
              },
              "mark": {
                "$ref": "#/components/schemas/Mark"
              },
              "createdAt": {
                "type": "string",
                "minLength": 20
              },
              "vendor": {
                "$ref": "#/components/schemas/Vendor"
              },
              "kind": {
                "type": "string",
                "const": "PAID_BILL"
              },
              "payload": {
                "type": "object",
                "properties": {
                  "supplierName": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 500
                  },
                  "number": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 500
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "dueDate": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "paidOn": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  },
                  "currency": {
                    "type": "string",
                    "pattern": "^[A-Z]{3}$"
                  },
                  "subtotalMinor": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^-?\\d+$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "taxMinor": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^-?\\d+$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "totalMinor": {
                    "type": "string",
                    "pattern": "^-?\\d+$"
                  },
                  "functionalTotalMinor": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^-?\\d+$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "paymentMethod": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 500
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "paymentReference": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 500
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "memo": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 500
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "supplierName",
                  "number",
                  "dueDate",
                  "paidOn",
                  "currency",
                  "subtotalMinor",
                  "taxMinor",
                  "totalMinor",
                  "functionalTotalMinor",
                  "paymentMethod",
                  "paymentReference",
                  "memo"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "id",
              "occurredOn",
              "occurredAt",
              "occurredZone",
              "periodYear",
              "periodMonth",
              "subject",
              "entityId",
              "entityName",
              "payloadVersion",
              "mark",
              "createdAt",
              "vendor",
              "kind",
              "payload"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "occurredOn": {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
              },
              "occurredAt": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 20
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "occurredZone": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "periodYear": {
                "anyOf": [
                  {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "periodMonth": {
                "anyOf": [
                  {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "subject": {
                "type": "string"
              },
              "entityId": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "entityName": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "payloadVersion": {
                "type": "integer",
                "minimum": 1,
                "maximum": 9007199254740991
              },
              "mark": {
                "$ref": "#/components/schemas/Mark"
              },
              "createdAt": {
                "type": "string",
                "minLength": 20
              },
              "vendor": {
                "$ref": "#/components/schemas/Vendor"
              },
              "kind": {
                "type": "string",
                "const": "VENDOR_PAYMENT"
              },
              "payload": {
                "type": "object",
                "properties": {
                  "supplierName": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 500
                  },
                  "currency": {
                    "type": "string",
                    "pattern": "^[A-Z]{3}$"
                  },
                  "amountMinor": {
                    "type": "string",
                    "pattern": "^-?\\d+$"
                  },
                  "method": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 500
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "reference": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 500
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "paidFromAccountName": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 500
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "billsAppliedText": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 500
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "memo": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 500
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "supplierName",
                  "currency",
                  "amountMinor",
                  "method",
                  "reference",
                  "paidFromAccountName",
                  "billsAppliedText",
                  "memo"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "id",
              "occurredOn",
              "occurredAt",
              "occurredZone",
              "periodYear",
              "periodMonth",
              "subject",
              "entityId",
              "entityName",
              "payloadVersion",
              "mark",
              "createdAt",
              "vendor",
              "kind",
              "payload"
            ],
            "additionalProperties": false
          }
        ]
      },
      "RecordReceiptResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "entityId": {
            "type": "string"
          },
          "entityName": {
            "type": "string"
          },
          "customer": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "displayName": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "displayName"
            ],
            "additionalProperties": false
          },
          "receivedOn": {
            "type": "string",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
          },
          "amountMinor": {
            "type": "string",
            "pattern": "^-?\\d+$"
          },
          "appliedMinor": {
            "type": "string",
            "pattern": "^-?\\d+$"
          },
          "unappliedMinor": {
            "type": "string",
            "pattern": "^-?\\d+$"
          },
          "currency": {
            "type": "string",
            "pattern": "^[A-Z]{3}$"
          },
          "method": {
            "type": "string",
            "enum": [
              "EFT",
              "CHEQUE",
              "CARD",
              "CASH",
              "OTHER",
              "PAD",
              "WIRE",
              "DIRECT_DEPOSIT",
              "ETRANSFER"
            ]
          },
          "processor": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "STRIPE",
                  "SHOPIFY",
                  "SQUARE"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "reference": {
            "type": [
              "string",
              "null"
            ]
          },
          "bankAccount": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "displayName": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "displayName"
            ],
            "additionalProperties": false
          },
          "sourceTransactionId": {
            "type": [
              "string",
              "null"
            ]
          },
          "entryId": {
            "type": [
              "string",
              "null"
            ]
          },
          "entryNumber": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ]
          },
          "entryStatus": {
            "type": [
              "string",
              "null"
            ]
          },
          "preGoLive": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "goLiveDate": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  }
                },
                "required": [
                  "goLiveDate"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "recordedBy": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "name"
            ],
            "additionalProperties": false
          },
          "createdAt": {
            "type": "string",
            "minLength": 20
          },
          "applications": {
            "$ref": "#/components/schemas/Applications"
          },
          "direction": {
            "type": "string",
            "enum": [
              "IN",
              "OUT"
            ]
          },
          "refundedMinor": {
            "type": "string",
            "pattern": "^-?\\d+$"
          },
          "voided": {
            "$ref": "#/components/schemas/Voided2"
          },
          "deposit": {
            "$ref": "#/components/schemas/Deposit"
          }
        },
        "required": [
          "id",
          "entityId",
          "entityName",
          "customer",
          "receivedOn",
          "amountMinor",
          "appliedMinor",
          "unappliedMinor",
          "currency",
          "method",
          "reference",
          "bankAccount",
          "sourceTransactionId",
          "entryId",
          "entryNumber",
          "entryStatus",
          "recordedBy",
          "createdAt",
          "applications",
          "direction",
          "refundedMinor",
          "voided",
          "deposit"
        ],
        "additionalProperties": false
      },
      "Refused": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "invoiceId": {
              "type": "string"
            },
            "number": {
              "type": "string"
            },
            "reason": {
              "type": "string"
            }
          },
          "required": [
            "invoiceId",
            "number",
            "reason"
          ],
          "additionalProperties": false
        }
      },
      "RequestReceivablesAuditPackageResponseOption1": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "entityId": {
            "type": "string"
          },
          "periodEnd": {
            "type": "string",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
          },
          "receiptDays": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "cutOffDays": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "confirmationThresholdMinor": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^-?\\d+$"
              },
              {
                "type": "null"
              }
            ]
          },
          "confirmationTopN": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ]
          },
          "auditorFirmName": {
            "type": "string"
          },
          "auditorReplyAddress": {
            "type": "string"
          },
          "state": {
            "type": "string",
            "enum": [
              "QUEUED",
              "BUILDING",
              "READY",
              "FAILED"
            ]
          },
          "jobId": {
            "type": [
              "string",
              "null"
            ]
          },
          "byteSize": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ]
          },
          "failureReason": {
            "type": [
              "string",
              "null"
            ]
          },
          "requestedBy": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "name"
            ],
            "additionalProperties": false
          },
          "requestedAt": {
            "type": "string",
            "minLength": 20
          },
          "builtAt": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 20
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "entityId",
          "periodEnd",
          "receiptDays",
          "cutOffDays",
          "confirmationThresholdMinor",
          "confirmationTopN",
          "auditorFirmName",
          "auditorReplyAddress",
          "state",
          "jobId",
          "byteSize",
          "failureReason",
          "requestedBy",
          "requestedAt",
          "builtAt"
        ],
        "additionalProperties": false
      },
      "Rows": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "id": {
              "type": "string"
            },
            "displayName": {
              "type": "string"
            },
            "status": {
              "type": "string",
              "enum": [
                "ACTIVE",
                "ARCHIVED"
              ]
            },
            "reasons": {
              "minItems": 1,
              "type": "array",
              "items": {
                "type": "string",
                "enum": [
                  "name",
                  "email",
                  "gstHstNumber",
                  "businessNumber",
                  "nameInAnotherCurrency"
                ]
              }
            }
          },
          "required": [
            "id",
            "displayName",
            "status",
            "reasons"
          ],
          "additionalProperties": false
        }
      },
      "RowsItem": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "lineNumber": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "cells": {
            "$ref": "#/components/schemas/Cells"
          },
          "edits": {
            "$ref": "#/components/schemas/Cells"
          },
          "values": {
            "$ref": "#/components/schemas/Cells"
          },
          "dimensions": {
            "$ref": "#/components/schemas/Dimensions3"
          },
          "problems": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "field": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/MappingValue"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "message": {
                  "type": "string"
                }
              },
              "required": [
                "field",
                "message"
              ],
              "additionalProperties": false
            }
          },
          "invoiceId": {
            "type": [
              "string",
              "null"
            ]
          },
          "invoiceNumber": {
            "type": [
              "string",
              "null"
            ]
          },
          "refusal": {
            "type": [
              "string",
              "null"
            ]
          },
          "confidenceBp": {
            "anyOf": [
              {
                "type": "object",
                "propertyNames": {
                  "$ref": "#/components/schemas/MappingValue"
                },
                "additionalProperties": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 10000
                }
              },
              {
                "type": "null"
              }
            ]
          },
          "newCustomer": {
            "type": "boolean"
          },
          "alreadyOnBooks": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "invoiceId": {
                    "type": "string"
                  },
                  "invoiceNumber": {
                    "type": "string"
                  }
                },
                "required": [
                  "invoiceId",
                  "invoiceNumber"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "customCells": {
            "type": "object",
            "propertyNames": {
              "type": "string",
              "pattern": "^[a-z][a-z0-9_]{0,39}$"
            },
            "additionalProperties": {
              "type": "string",
              "maxLength": 500
            }
          },
          "customEdits": {
            "type": "object",
            "propertyNames": {
              "type": "string",
              "pattern": "^[a-z][a-z0-9_]{0,39}$"
            },
            "additionalProperties": {
              "type": "string",
              "maxLength": 500
            }
          },
          "customValues": {
            "type": "object",
            "propertyNames": {
              "type": "string",
              "pattern": "^[a-z][a-z0-9_]{0,39}$"
            },
            "additionalProperties": {
              "type": "string",
              "maxLength": 500
            }
          },
          "customProblems": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "key": {
                  "type": "string"
                },
                "message": {
                  "type": "string"
                }
              },
              "required": [
                "key",
                "message"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "id",
          "lineNumber",
          "cells",
          "edits",
          "values",
          "dimensions",
          "problems",
          "invoiceId",
          "invoiceNumber",
          "refusal",
          "confidenceBp",
          "newCustomer"
        ],
        "additionalProperties": false
      },
      "Sections": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "section": {
              "type": "string",
              "enum": [
                "ASSET",
                "LIABILITY",
                "EQUITY",
                "REVENUE",
                "EXPENSE"
              ]
            },
            "rows": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "accountId": {
                    "type": "string"
                  },
                  "code": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  },
                  "type": {
                    "type": "string",
                    "enum": [
                      "ASSET",
                      "LIABILITY",
                      "EQUITY",
                      "REVENUE",
                      "EXPENSE"
                    ]
                  },
                  "gifiCode": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "aspeLine": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "currency": {
                    "type": "string"
                  },
                  "balanceMinor": {
                    "type": "string",
                    "pattern": "^-?\\d+$"
                  },
                  "debitMinor": {
                    "type": "string",
                    "pattern": "^-?\\d+$"
                  },
                  "creditMinor": {
                    "type": "string",
                    "pattern": "^-?\\d+$"
                  }
                },
                "required": [
                  "accountId",
                  "code",
                  "name",
                  "type",
                  "gifiCode",
                  "aspeLine",
                  "currency",
                  "balanceMinor",
                  "debitMinor",
                  "creditMinor"
                ],
                "additionalProperties": false
              }
            },
            "totalMinor": {
              "type": "string",
              "pattern": "^-?\\d+$"
            }
          },
          "required": [
            "section",
            "rows",
            "totalMinor"
          ],
          "additionalProperties": false
        }
      },
      "SendCustomerStatementResponse": {
        "type": "object",
        "properties": {
          "outcome": {
            "type": "string",
            "enum": [
              "SENT",
              "PARTLY_SENT",
              "FAILED",
              "PROPOSED",
              "DECLINED"
            ]
          },
          "proposalId": {
            "type": [
              "string",
              "null"
            ]
          },
          "deliveries": {
            "$ref": "#/components/schemas/Deliveries"
          },
          "newRecipients": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "required": [
          "outcome",
          "proposalId",
          "deliveries",
          "newRecipients"
        ],
        "additionalProperties": false
      },
      "SubmitInvoiceRequest": {
        "type": "object",
        "properties": {
          "note": {
            "type": "string",
            "maxLength": 500
          },
          "acknowledgements": {
            "default": [],
            "maxItems": 100,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "code": {
                  "$ref": "#/components/schemas/Code2"
                },
                "subjectKey": {
                  "default": "",
                  "type": "string",
                  "maxLength": 120
                },
                "note": {
                  "default": "",
                  "type": "string",
                  "maxLength": 500
                }
              },
              "required": [
                "code"
              ],
              "additionalProperties": false
            }
          }
        },
        "additionalProperties": false
      },
      "TaxLines": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "code": {
              "type": "string"
            },
            "name": {
              "type": "string"
            },
            "ratePercent": {
              "type": "string",
              "pattern": "^\\d{1,3}(\\.\\d{1,5})?$"
            },
            "baseMinor": {
              "type": "string",
              "pattern": "^-?\\d+$"
            },
            "taxMinor": {
              "type": "string",
              "pattern": "^-?\\d+$"
            }
          },
          "required": [
            "code",
            "name",
            "ratePercent",
            "baseMinor",
            "taxMinor"
          ],
          "additionalProperties": false
        }
      },
      "Totals": {
        "type": "object",
        "properties": {
          "native": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "imported": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          }
        },
        "required": [
          "native",
          "imported"
        ],
        "additionalProperties": false
      },
      "UndoAgentBatchResponse": {
        "type": "object",
        "properties": {
          "outcome": {
            "type": "string",
            "const": "job_started"
          },
          "job": {
            "$ref": "#/components/schemas/Job"
          },
          "existing": {
            "type": "boolean"
          }
        },
        "required": [
          "outcome",
          "job",
          "existing"
        ],
        "additionalProperties": false
      },
      "Vendor": {
        "default": null,
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "displayName": {
                "type": "string"
              },
              "placement": {
                "type": "string",
                "enum": [
                  "NAME",
                  "ALIAS"
                ]
              }
            },
            "required": [
              "id",
              "displayName",
              "placement"
            ],
            "additionalProperties": false
          },
          {
            "type": "null"
          }
        ]
      },
      "ViewsItem": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "report": {
            "type": "string",
            "enum": [
              "sales-by-customer",
              "sales-by-item",
              "delivered-not-billed",
              "sales-by-month",
              "tax-collected",
              "invoice-register",
              "ageing",
              "sends",
              "credit-memos",
              "deferred-revenue"
            ]
          },
          "name": {
            "type": "string"
          },
          "filters": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {
              "type": "string"
            }
          },
          "createdAt": {
            "type": "string",
            "minLength": 20
          },
          "updatedAt": {
            "type": "string",
            "minLength": 20
          }
        },
        "required": [
          "id",
          "report",
          "name",
          "filters",
          "createdAt",
          "updatedAt"
        ],
        "additionalProperties": false
      },
      "Voided2": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "at": {
                "type": "string",
                "minLength": 20
              },
              "by": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  }
                },
                "required": [
                  "id",
                  "name"
                ],
                "additionalProperties": false
              },
              "reason": {
                "type": "string"
              },
              "entryId": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "entryNumber": {
                "anyOf": [
                  {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "entryStatus": {
                "anyOf": [
                  {
                    "type": "string",
                    "enum": [
                      "DRAFT",
                      "PROPOSED",
                      "IN_REVIEW",
                      "APPROVED",
                      "POSTED",
                      "DECLINED",
                      "REVERSED"
                    ]
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "at",
              "by",
              "reason",
              "entryId",
              "entryNumber",
              "entryStatus"
            ],
            "additionalProperties": false
          },
          {
            "type": "null"
          }
        ]
      },
      "Warnings": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "code": {
              "$ref": "#/components/schemas/Code2"
            },
            "taxType": {
              "anyOf": [
                {
                  "type": "string",
                  "enum": [
                    "GST_HST",
                    "QST",
                    "PST_BC",
                    "PST_SK",
                    "PST_MB",
                    "US_SALES_TAX"
                  ]
                },
                {
                  "type": "null"
                }
              ]
            },
            "region": {
              "anyOf": [
                {
                  "type": "string",
                  "pattern": "^(CA|US)-[A-Z]{2}$"
                },
                {
                  "type": "null"
                }
              ]
            },
            "currency": {
              "anyOf": [
                {
                  "type": "string",
                  "pattern": "^[A-Z]{3}$"
                },
                {
                  "type": "null"
                }
              ]
            },
            "newestRateOn": {
              "anyOf": [
                {
                  "type": "string",
                  "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                },
                {
                  "type": "null"
                }
              ]
            },
            "band": {
              "anyOf": [
                {
                  "type": "string",
                  "enum": [
                    "A",
                    "B",
                    "C",
                    "D",
                    "E",
                    "N"
                  ]
                },
                {
                  "type": "null"
                }
              ]
            },
            "message": {
              "type": "string"
            },
            "remedy": {
              "type": "string"
            },
            "row": {
              "anyOf": [
                {
                  "type": "integer",
                  "minimum": 1,
                  "maximum": 9007199254740991
                },
                {
                  "type": "null"
                }
              ]
            }
          },
          "required": [
            "code",
            "taxType",
            "region",
            "currency",
            "newestRateOn",
            "band",
            "message",
            "remedy"
          ],
          "additionalProperties": false
        }
      },
      "Warnings2": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "code": {
              "type": "string",
              "enum": [
                "SECTION_232_WINDOW"
              ]
            },
            "message": {
              "type": "string"
            },
            "remedy": {
              "type": "string"
            }
          },
          "required": [
            "code",
            "message",
            "remedy"
          ],
          "additionalProperties": false
        }
      }
    },
    "responses": {
      "Problem400": {
        "description": "The request has no Idempotency-Key header.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/XRequestId"
          }
        },
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/ProblemDetails"
            }
          }
        }
      },
      "Problem401": {
        "description": "The key or token is missing, malformed, unknown, revoked or expired.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/XRequestId"
          }
        },
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/ProblemDetails"
            }
          }
        }
      },
      "Problem403": {
        "description": "The key or token may not do this, or the books are closed to the API.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/XRequestId"
          }
        },
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/ProblemDetails"
            }
          }
        }
      },
      "Problem404": {
        "description": "There is no such record on these books.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/XRequestId"
          }
        },
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/ProblemDetails"
            }
          }
        }
      },
      "Problem409": {
        "description": "An identical request is still running, or another change reached the record first.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/XRequestId"
          }
        },
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/ProblemDetails"
            }
          }
        }
      },
      "Problem412": {
        "description": "The books refuse this in their current state. The problem body says what to change.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/XRequestId"
          }
        },
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/ProblemDetails"
            }
          }
        }
      },
      "Problem422": {
        "description": "A field is invalid or cannot be set through the API, or the Idempotency-Key was reused for a different request.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/XRequestId"
          }
        },
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/ProblemDetails"
            }
          }
        }
      },
      "Problem429": {
        "description": "Too many requests. Wait the number of seconds in Retry-After.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/XRequestId"
          },
          "Retry-After": {
            "$ref": "#/components/headers/RetryAfter"
          },
          "RateLimit-Policy": {
            "$ref": "#/components/headers/RateLimitPolicy"
          },
          "RateLimit": {
            "$ref": "#/components/headers/RateLimit"
          }
        },
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/ProblemDetails"
            }
          }
        }
      },
      "Problem500": {
        "description": "A fault on our side. Quote the X-Request-Id when you write to us.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/XRequestId"
          }
        },
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/ProblemDetails"
            }
          }
        }
      }
    },
    "parameters": {
      "IdempotencyKey": {
        "name": "Idempotency-Key",
        "in": "header",
        "required": true,
        "description": "A new value for each new request (a UUID is fine), the same value when you retry it. Kept for 7 days.",
        "schema": {
          "type": "string",
          "minLength": 1,
          "maxLength": 255
        }
      }
    },
    "headers": {
      "XRequestId": {
        "description": "Quote this when you write to us about the call.",
        "schema": {
          "type": "string"
        }
      },
      "RateLimitPolicy": {
        "description": "The quota and window of this class of call, for example \"reads\";q=300;w=60.",
        "schema": {
          "type": "string"
        }
      },
      "RateLimit": {
        "description": "What is left of the quota and when it resets, for example \"reads\";r=250;t=30.",
        "schema": {
          "type": "string"
        }
      },
      "RetryAfter": {
        "description": "Seconds to wait before sending the same request again.",
        "schema": {
          "type": "integer",
          "minimum": 0
        }
      },
      "LedgerPosition": {
        "description": "The position in the ledger's event log after this write. Pass it to listEvents as startPosition to read what followed.",
        "schema": {
          "type": "string",
          "pattern": "^[0-9]{1,19}$"
        }
      },
      "Location": {
        "description": "Where to read the record that was created, or the page where a person confirms the act.",
        "schema": {
          "type": "string"
        }
      }
    }
  }
}
